]> git.ipfire.org Git - thirdparty/libnl.git/commitdiff
Fix use of uninitialized data at the end of netlink message
authorThomas Graf <tgraf@suug.ch>
Thu, 28 Oct 2010 22:17:07 +0000 (00:17 +0200)
committerThomas Graf <tgraf@suug.ch>
Thu, 28 Oct 2010 22:17:07 +0000 (00:17 +0200)
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.

lib/msg.c

index 9fe9d5418c06b5523a273e9b4ebb6c1f3b68268b..6a8e14a9eda305bfb419967a485a1580b88a2985 100644 (file)
--- 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;