[PATCH net-next] ndisc: Check NS message length before access.

Subsystems: networking [general], networking [ipv4/ipv6], the rest

STALE4941d

2 messages, 2 authors, 2013-01-18 · open the first message on its own page

[PATCH net-next] ndisc: Check NS message length before access.

From: YOSHIFUJI Hideaki <hidden>
Date: 2013-01-18 12:05:04

Check message length before accessing "target" field,
as we do for other types.

Signed-off-by: YOSHIFUJI Hideaki <redacted>
---
 net/ipv6/ndisc.c |    5 +++++
 1 file changed, 5 insertions(+)
diff --git a/net/ipv6/ndisc.c b/net/ipv6/ndisc.c
index 429622d..350f860 100644
--- a/net/ipv6/ndisc.c
+++ b/net/ipv6/ndisc.c
@@ -671,6 +671,11 @@ static void ndisc_recv_ns(struct sk_buff *skb)
 	bool inc;
 	int is_router = -1;
 
+	if (skb->len < sizeof(struct nd_msg)) {
+		ND_PRINTK(2, warn, "NS: packet too short\n");
+		return;
+	}
+
 	if (ipv6_addr_is_multicast(&msg->target)) {
 		ND_PRINTK(2, warn, "NS: multicast target address\n");
 		return;
-- 
1.7.9.5

Re: [PATCH net-next] ndisc: Check NS message length before access.

From: David Miller <davem@davemloft.net>
Date: 2013-01-18 19:42:03

From: YOSHIFUJI Hideaki <redacted>
Date: Fri, 18 Jan 2013 21:05:03 +0900
Check message length before accessing "target" field,
as we do for other types.

Signed-off-by: YOSHIFUJI Hideaki <redacted>
Applied.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help