summaryrefslogtreecommitdiff
path: root/lib/msg.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2010-10-29 00:17:07 +0200
committerThomas Graf <tgraf@suug.ch>2010-10-29 00:17:07 +0200
commite1eacd6b16b014eb42bcf6683ebe2334c3a35c68 (patch)
tree4708227a9cb93a54a5d3f0c0325da7d450470eae /lib/msg.c
parentd0e564548f6eff0a8d49e5e9cb618a8d297a1b98 (diff)
downloadlibnl-e1eacd6b16b014eb42bcf6683ebe2334c3a35c68.tar.gz
Fix use of uninitialized data at the end of netlink message
The netlink message buffer is preallocated to a page and later expanded as needed. Everything was properly paded and zeroed out except for the unused part at the end. Use calloc() to allocate the buffer.
Diffstat (limited to 'lib/msg.c')
-rw-r--r--lib/msg.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/msg.c b/lib/msg.c
index 9fe9d54..6a8e14a 100644
--- a/lib/msg.c
+++ b/lib/msg.c
@@ -374,7 +374,7 @@ static struct nl_msg *__nlmsg_alloc(size_t len)
nm->nm_refcnt = 1;
- nm->nm_nlh = malloc(len);
+ nm->nm_nlh = calloc(1, len);
if (!nm->nm_nlh)
goto errout;