aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv6/ndisc.c
diff options
context:
space:
mode:
authorYOSHIFUJI Hideaki / 吉藤英明 <yoshfuji@linux-ipv6.org>2013-01-17 21:05:03 -0500
committerDavid S. Miller <davem@davemloft.net>2013-01-18 14:41:13 -0500
commit115b0aa6b444e8dd89b7f67b77b8c472763fbc1a (patch)
treed242f8dcb91fcaceb14011874c5d6a5f74f7e0de /net/ipv6/ndisc.c
parent12fd84f4383b15b0a12cfd50b7c527cd55d6f101 (diff)
ndisc: Check NS message length before access.
Check message length before accessing "target" field, as we do for other types. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv6/ndisc.c')
-rw-r--r--net/ipv6/ndisc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 429622d74705..350f86005c13 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -671,6 +671,11 @@ static void ndisc_recv_ns(struct sk_buff *skb)
671 bool inc; 671 bool inc;
672 int is_router = -1; 672 int is_router = -1;
673 673
674 if (skb->len < sizeof(struct nd_msg)) {
675 ND_PRINTK(2, warn, "NS: packet too short\n");
676 return;
677 }
678
674 if (ipv6_addr_is_multicast(&msg->target)) { 679 if (ipv6_addr_is_multicast(&msg->target)) {
675 ND_PRINTK(2, warn, "NS: multicast target address\n"); 680 ND_PRINTK(2, warn, "NS: multicast target address\n");
676 return; 681 return;