aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorYasuyuki Kozakai <yasuyuki.kozakai@toshiba.co.jp>2005-12-05 16:32:50 -0500
committerDavid S. Miller <davem@davemloft.net>2005-12-05 16:32:50 -0500
commitf16c910724250c1af0f53111b4c76505000819f6 (patch)
tree8b64d67f21ebab0a2127b1ca53679a47a9aca174 /net
parent8d1ca69984ed1e5930c0537b8f606c54007d7319 (diff)
[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> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv6/netfilter/nf_conntrack_proto_icmpv6.c12
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 c0f1da5497a9..a7e03cfacd06 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_conntrack_tuple *tuple,
68 [ICMPV6_NI_REPLY - 128] = ICMPV6_NI_REPLY +1 68 [ICMPV6_NI_REPLY - 128] = ICMPV6_NI_REPLY +1
69 }; 69 };
70 70
71 __u8 type = orig->dst.u.icmp.type - 128; 71 int type = orig->dst.u.icmp.type - 128;
72 if (type >= sizeof(invmap) || !invmap[type]) 72 if (type < 0 || type >= sizeof(invmap) || !invmap[type])
73 return 0; 73 return 0;
74 74
75 tuple->src.u.icmp.id = orig->src.u.icmp.id; 75 tuple->src.u.icmp.id = orig->src.u.icmp.id;
@@ -129,12 +129,12 @@ static int icmpv6_new(struct nf_conn *conntrack,
129 [ICMPV6_ECHO_REQUEST - 128] = 1, 129 [ICMPV6_ECHO_REQUEST - 128] = 1,
130 [ICMPV6_NI_QUERY - 128] = 1 130 [ICMPV6_NI_QUERY - 128] = 1
131 }; 131 };
132 int type = conntrack->tuplehash[0].tuple.dst.u.icmp.type - 128;
132 133
133 if (conntrack->tuplehash[0].tuple.dst.u.icmp.type - 128 >= sizeof(valid_new) 134 if (type < 0 || type >= sizeof(valid_new) || !valid_new[type]) {
134 || !valid_new[conntrack->tuplehash[0].tuple.dst.u.icmp.type - 128]) {
135 /* Can't create a new ICMPv6 `conn' with this. */ 135 /* Can't create a new ICMPv6 `conn' with this. */
136 DEBUGP("icmp: can't create new conn with type %u\n", 136 DEBUGP("icmpv6: can't create new conn with type %u\n",
137 conntrack->tuplehash[0].tuple.dst.u.icmp.type); 137 type + 128);
138 NF_CT_DUMP_TUPLE(&conntrack->tuplehash[0].tuple); 138 NF_CT_DUMP_TUPLE(&conntrack->tuplehash[0].tuple);
139 return 0; 139 return 0;
140 } 140 }