All of lore.kernel.org
 help / color / mirror / Atom feed
From: Patrick McHardy <kaber@trash.net>
To: David S. Miller <davem@davemloft.net>
Cc: netfilter-devel@lists.netfilter.org, Patrick McHardy <kaber@trash.net>
Subject: [NETFILTER 1/9]: nf_conntrack: Fix missing check for ICMPv6 type
Date: Sun, 04 Dec 2005 22:01:17 +0100	[thread overview]
Message-ID: <20051204210117.24032.63147.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20051204210116.24032.9802.sendpatchset@localhost.localdomain>

[NETFILTER]: nf_conntrack: Fix missing check for ICMPv6 type

This makes nf_conntrack_icmpv6 check that ICMPv6 type isn't < 128
to avoid accessing out of array valid_new[] and invmap[].

Signed-off-by: Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>
Signed-off-by: Patrick McHardy <kaber@trash.net>

---
commit e512e47b2238a9e367f05a36b4ac2ba53f5ad12e
tree faa3dc22ceff3549bc211cc48da4d1d63a9fab35
parent 436b0f76f2cee6617f27a649637766628909dd5d
author Yasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp> Sun, 04 Dec 2005 16:01:47 +0100
committer Patrick McHardy <kaber@trash.net> Sun, 04 Dec 2005 16:01:47 +0100

 net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
index c0f1da5..a7e03cf 100644
--- a/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
+++ b/net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c
@@ -68,8 +68,8 @@ static int icmpv6_invert_tuple(struct nf
 		[ICMPV6_NI_REPLY - 128]		= ICMPV6_NI_REPLY +1
 	};
 
-	__u8 type = orig->dst.u.icmp.type - 128;
-	if (type >= sizeof(invmap) || !invmap[type])
+	int type = orig->dst.u.icmp.type - 128;
+	if (type < 0 || type >= sizeof(invmap) || !invmap[type])
 		return 0;
 
 	tuple->src.u.icmp.id   = orig->src.u.icmp.id;
@@ -129,12 +129,12 @@ static int icmpv6_new(struct nf_conn *co
 		[ICMPV6_ECHO_REQUEST - 128] = 1,
 		[ICMPV6_NI_QUERY - 128] = 1
 	};
+	int type = conntrack->tuplehash[0].tuple.dst.u.icmp.type - 128;
 
-	if (conntrack->tuplehash[0].tuple.dst.u.icmp.type - 128 >= sizeof(valid_new)
-	    || !valid_new[conntrack->tuplehash[0].tuple.dst.u.icmp.type - 128]) {
+	if (type < 0 || type >= sizeof(valid_new) || !valid_new[type]) {
 		/* Can't create a new ICMPv6 `conn' with this. */
-		DEBUGP("icmp: can't create new conn with type %u\n",
-		       conntrack->tuplehash[0].tuple.dst.u.icmp.type);
+		DEBUGP("icmpv6: can't create new conn with type %u\n",
+		       type + 128);
 		NF_CT_DUMP_TUPLE(&conntrack->tuplehash[0].tuple);
 		return 0;
 	}

  reply	other threads:[~2005-12-04 21:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-04 21:01 [NETFILTER 0/9]: Netfilter fixes Patrick McHardy
2005-12-04 21:01 ` Patrick McHardy [this message]
2005-12-04 21:01 ` [NETFILTER 2/9]: nfnetlink: Fix calculation of minimum message length Patrick McHardy
2005-12-04 21:01 ` [NETFILTER 3/9]: Fix incorrect argument to ip_nat_initialized() in ctnetlink Patrick McHardy
2005-12-04 21:01 ` [NETFILTER 4/9]: Fix ip_conntrack_flush abuse " Patrick McHardy
2005-12-04 21:01 ` [NETFILTER 5/9]: Fix CTA_PROTO_NUM attribute size " Patrick McHardy
2005-12-04 21:01 ` [NETFILTER 6/9]: Mark ctnetlink as EXPERIMENTAL Patrick McHardy
2005-12-05 10:06   ` Pablo Neira Ayuso
2005-12-05 15:26     ` Patrick McHardy
2005-12-05 21:38       ` David S. Miller
2005-12-04 21:01 ` [NETFILTER 7/9]: Wait for untracked references in nf_conntrack module unload Patrick McHardy
2005-12-04 21:01 ` [NETFILTER 8/9]: Fix unbalanced read_unlock_bh in ctnetlink Patrick McHardy
2005-12-04 21:01 ` [NETFILTER 9/9]: Don't use conntrack entry after dropping the reference Patrick McHardy

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=20051204210117.24032.63147.sendpatchset@localhost.localdomain \
    --to=kaber@trash.net \
    --cc=davem@davemloft.net \
    --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.