From: Stephen Hemminger <shemminger@vyatta.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>
Cc: netfilter-devel@vger.kernel.org
Subject: libmnl: fix valgrind warnings about padding
Date: Wed, 18 Apr 2012 11:33:27 -0700 [thread overview]
Message-ID: <20120418113327.3d26501b@nehalam.linuxnetplumber.net> (raw)
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 unitialized byte.
--- 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);
next reply other threads:[~2012-04-18 18:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-18 18:33 Stephen Hemminger [this message]
2012-04-18 22:56 ` libmnl: fix valgrind warnings about padding Pablo Neira Ayuso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120418113327.3d26501b@nehalam.linuxnetplumber.net \
--to=shemminger@vyatta.com \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).