diff options
author | Stephen Hemminger <shemminger@vyatta.com> | 2012-04-19 00:50:38 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2012-04-19 00:55:19 +0200 |
commit | 5373fe81ca557a8f846fd6c0b68ee389808cfc3b (patch) | |
tree | 99334ef9da46ccff8c7a5b7365c9dd670edfd01b | |
parent | addadf80836cae8fbf55f5b844f8cc06cb7aeb6c (diff) | |
download | libmnl-5373fe81ca557a8f846fd6c0b68ee389808cfc3b.tar.gz libmnl-5373fe81ca557a8f846fd6c0b68ee389808cfc3b.zip |
nlmsg: fix valgrind warnings about padding
When using mnl_nlmsg_put_extra_header() it pads out the addtional
header but only zeros the original size not the padded value. Which
cause valgrind to complain about sendto() with uninitialized byte.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | src/nlmsg.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nlmsg.c b/src/nlmsg.c index cb2cbb8..000829e 100644 --- a/src/nlmsg.c +++ b/src/nlmsg.c @@ -105,8 +105,9 @@ void * mnl_nlmsg_put_extra_header(struct nlmsghdr *nlh, size_t size) { char *ptr = (char *)nlh + nlh->nlmsg_len; - nlh->nlmsg_len += MNL_ALIGN(size); - memset(ptr, 0, size); + size_t len = MNL_ALIGN(size); + nlh->nlmsg_len += len; + memset(ptr, 0, len); return ptr; } EXPORT_SYMBOL(mnl_nlmsg_put_extra_header); |