From: Thomas Jarosch <thomas.jarosch@intra2net.com>
To: netfilter-devel@vger.kernel.org
Subject: [libmnl PATCH] Improve nf-queue example: Avoid possible NULL pointer dereference
Date: Wed, 24 Aug 2011 18:48:33 +0200 [thread overview]
Message-ID: <4E552B61.6070706@intra2net.com> (raw)
Signed-off-by: Thomas Jarosch <thomas.jarosch@intra2net.com>
---
examples/netfilter/nf-queue.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/examples/netfilter/nf-queue.c b/examples/netfilter/nf-queue.c
index 3658ba2..a0ace28 100644
--- a/examples/netfilter/nf-queue.c
+++ b/examples/netfilter/nf-queue.c
@@ -72,9 +72,11 @@ static int queue_cb(const struct nlmsghdr *nlh, void *data)
if (tb[NFQA_PACKET_HDR]) {
ph = mnl_attr_get_payload(tb[NFQA_PACKET_HDR]);
id = ntohl(ph->packet_id);
- }
- printf("packet received (id=%u hw=0x%04x hook=%u)\n",
- id, ntohs(ph->hw_protocol), ph->hook);
+
+ printf("packet received (id=%u hw=0x%04x hook=%u)\n",
+ id, ntohs(ph->hw_protocol), ph->hook);
+ } else
+ printf("packet received without header\n");
return MNL_CB_OK + id;
}
--
1.7.4.4
reply other threads:[~2011-08-24 17:13 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=4E552B61.6070706@intra2net.com \
--to=thomas.jarosch@intra2net.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).