netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Popelka <jpopelka@redhat.com>
To: netfilter-devel@vger.kernel.org
Cc: Jiri Popelka <jpopelka@redhat.com>
Subject: [PATCH] libnfnetlink: BAD_SIZEOF
Date: Fri, 10 Jun 2011 11:11:00 +0200	[thread overview]
Message-ID: <1307697060-6572-1-git-send-email-jpopelka@redhat.com> (raw)

static analysis (analysis based only on compiling of sources, not based on running of binary)
of the code revealed the following problem:

libnfnetlink.c:481: Taking the size of pointer parameter "nlh" is suspicious.
libnfnetlink.c:486: Taking the size of pointer parameter "nlh" is suspicious.
---
 src/libnfnetlink.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/libnfnetlink.c b/src/libnfnetlink.c
index 6e7afc6..2f962fc 100644
--- a/src/libnfnetlink.c
+++ b/src/libnfnetlink.c
@@ -477,12 +477,12 @@ nfnl_parse_hdr(const struct nfnl_handle *nfnlh,
 
 	if (nlh->nlmsg_len == NLMSG_LENGTH(sizeof(struct nfgenmsg))) {
 		if (genmsg)
-			*genmsg = (void *)nlh + sizeof(nlh);
+			*genmsg = (void *)nlh + sizeof(*nlh);
 		return NULL;
 	}
 
 	if (genmsg)
-		*genmsg = (void *)nlh + sizeof(nlh);
+		*genmsg = (void *)nlh + sizeof(*nlh);
 
 	return (void *)nlh + NLMSG_LENGTH(sizeof(struct nfgenmsg));
 }
-- 
1.7.5.2


             reply	other threads:[~2011-06-10  9:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-10  9:11 Jiri Popelka [this message]
2011-06-13 17:52 ` [PATCH] libnfnetlink: BAD_SIZEOF 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=1307697060-6572-1-git-send-email-jpopelka@redhat.com \
    --to=jpopelka@redhat.com \
    --cc=netfilter-devel@vger.kernel.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).