From: Thomas Graf Date: Thu, 28 Oct 2010 22:17:07 +0000 (+0200) Subject: Fix use of uninitialized data at the end of netlink message X-Git-Tag: libnl3_0~83 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1eacd6b16b014eb42bcf6683ebe2334c3a35c68;p=thirdparty%2Flibnl.git 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. --- 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;