All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pablo Neira Ayuso <pablo@eurodev.net>
To: Netfilter Development Mailinglist <netfilter-devel@lists.netfilter.org>
Cc: Harald Welte <laforge@netfilter.org>, Patrick McHardy <kaber@trash.net>
Subject: [LIBNFNETLINK 1/3] Add NLMSG_OK checking to nfnl_get_msg_next
Date: Sun, 12 Feb 2006 22:39:21 +0100	[thread overview]
Message-ID: <43EFAB09.4020007@eurodev.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 89 bytes --]

nfnl_get_msg_next must check is the message is OK after NLMSG_NEXT is
called.

-- 
Pablo

[-- Attachment #2: 01.patch --]
[-- Type: text/plain, Size: 690 bytes --]

[LIBNFNETLINK] Add NLMSG_OK checking to nfnl_get_msg_next

nfnl_get_msg_next must check is the message is OK after NLMSG_NEXT
is called.

Index: libnfnetlink/src/libnfnetlink.c
===================================================================
--- libnfnetlink.orig/src/libnfnetlink.c	2006-02-12 19:24:26.000000000 +0100
+++ libnfnetlink/src/libnfnetlink.c	2006-02-12 19:28:19.000000000 +0100
@@ -861,6 +861,11 @@ struct nlmsghdr *nfnl_get_msg_next(struc
 	remain_len = (len - ((unsigned char *)h->last_nlhdr - buf));
 	nlh = NLMSG_NEXT(h->last_nlhdr, remain_len);
 
+	if (!NLMSG_OK(nlh, remain_len)) {
+		h->last_nlhdr = NULL;
+		return NULL;
+	}
+
 	h->last_nlhdr = nlh;
 
 	return nlh;

             reply	other threads:[~2006-02-12 21:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-12 21:39 Pablo Neira Ayuso [this message]
2006-02-13 11:34 ` [LIBNFNETLINK 1/3] Add NLMSG_OK checking to nfnl_get_msg_next Harald Welte

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=43EFAB09.4020007@eurodev.net \
    --to=pablo@eurodev.net \
    --cc=kaber@trash.net \
    --cc=laforge@netfilter.org \
    --cc=netfilter-devel@lists.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.