fix more instances of uninitialized padding bytes
This commit is contained in:
parent
7c80b7c514
commit
51711be625
3 changed files with 5 additions and 2 deletions
4
blob.c
4
blob.c
|
@ -67,6 +67,7 @@ blob_add(struct blob_buf *buf, struct blob_attr *pos, int id, int payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
blob_init(attr, id, payload + sizeof(struct blob_attr));
|
blob_init(attr, id, payload + sizeof(struct blob_attr));
|
||||||
|
blob_fill_pad(attr);
|
||||||
return attr;
|
return attr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +92,7 @@ blob_buf_free(struct blob_buf *buf)
|
||||||
buf->buflen = 0;
|
buf->buflen = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
blob_fill_pad(struct blob_attr *attr)
|
blob_fill_pad(struct blob_attr *attr)
|
||||||
{
|
{
|
||||||
char *buf = (char *) attr;
|
char *buf = (char *) attr;
|
||||||
|
@ -109,7 +110,6 @@ blob_set_raw_len(struct blob_attr *attr, unsigned int len)
|
||||||
len &= BLOB_ATTR_LEN_MASK;
|
len &= BLOB_ATTR_LEN_MASK;
|
||||||
len |= (id << BLOB_ATTR_ID_SHIFT) & BLOB_ATTR_ID_MASK;
|
len |= (id << BLOB_ATTR_ID_SHIFT) & BLOB_ATTR_ID_MASK;
|
||||||
attr->id_len = cpu_to_be32(len);
|
attr->id_len = cpu_to_be32(len);
|
||||||
blob_fill_pad(attr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct blob_attr *
|
struct blob_attr *
|
||||||
|
|
1
blob.h
1
blob.h
|
@ -204,6 +204,7 @@ blob_next(const struct blob_attr *attr)
|
||||||
return (struct blob_attr *) ((char *) attr + blob_pad_len(attr));
|
return (struct blob_attr *) ((char *) attr + blob_pad_len(attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void blob_fill_pad(struct blob_attr *attr);
|
||||||
extern void blob_set_raw_len(struct blob_attr *attr, unsigned int len);
|
extern void blob_set_raw_len(struct blob_attr *attr, unsigned int len);
|
||||||
extern bool blob_attr_equal(const struct blob_attr *a1, const struct blob_attr *a2);
|
extern bool blob_attr_equal(const struct blob_attr *a1, const struct blob_attr *a2);
|
||||||
extern int blob_buf_init(struct blob_buf *buf, int id);
|
extern int blob_buf_init(struct blob_buf *buf, int id);
|
||||||
|
|
|
@ -188,6 +188,8 @@ blobmsg_add_string_buffer(struct blob_buf *buf)
|
||||||
|
|
||||||
attrlen = blob_raw_len(attr) + len;
|
attrlen = blob_raw_len(attr) + len;
|
||||||
blob_set_raw_len(attr, attrlen);
|
blob_set_raw_len(attr, attrlen);
|
||||||
|
blob_fill_pad(attr);
|
||||||
|
|
||||||
blob_set_raw_len(buf->head, blob_raw_len(buf->head) + blob_pad_len(attr));
|
blob_set_raw_len(buf->head, blob_raw_len(buf->head) + blob_pad_len(attr));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue