Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2011-10-06 19:57:13 +0400
committerFelix Fietkau <nbd@openwrt.org>2011-10-06 19:57:13 +0400
commit51711be6251be4ae5e53f9369ae04598b06df0e7 (patch)
treeb7df042f992304d1582366210fade3754018ef69
parent7c80b7c5147ac55455464224bd0a3f6aac0b51d0 (diff)
fix more instances of uninitialized padding bytes
-rw-r--r--blob.c4
-rw-r--r--blob.h1
-rw-r--r--blobmsg.c2
3 files changed, 5 insertions, 2 deletions
diff --git a/blob.c b/blob.c
index e59a6d0..4817fd4 100644
--- a/blob.c
+++ b/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_fill_pad(attr);
return attr;
}
@@ -91,7 +92,7 @@ blob_buf_free(struct blob_buf *buf)
buf->buflen = 0;
}
-static void
+void
blob_fill_pad(struct blob_attr *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 |= (id << BLOB_ATTR_ID_SHIFT) & BLOB_ATTR_ID_MASK;
attr->id_len = cpu_to_be32(len);
- blob_fill_pad(attr);
}
struct blob_attr *
diff --git a/blob.h b/blob.h
index 460ea5e..b21c5bb 100644
--- a/blob.h
+++ b/blob.h
@@ -204,6 +204,7 @@ blob_next(const struct blob_attr *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 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);
diff --git a/blobmsg.c b/blobmsg.c
index 0551b26..8a40bf8 100644
--- a/blobmsg.c
+++ b/blobmsg.c
@@ -188,6 +188,8 @@ blobmsg_add_string_buffer(struct blob_buf *buf)
attrlen = blob_raw_len(attr) + len;
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));
}