From: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6•org>
To: David Miller <davem@davemloft•net>, netdev <netdev@vger•kernel.org>
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6•org>
Subject: [PATCH net-next] ndisc: Check NS message length before access.
Date: Fri, 18 Jan 2013 21:05:03 +0900 [thread overview]
Message-ID: <50F93A6F.9020303@linux-ipv6.org> (raw)
Check message length before accessing "target" field,
as we do for other types.
Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6•org>
---
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
next reply other threads:[~2013-01-18 12:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-18 12:05 YOSHIFUJI Hideaki [this message]
2013-01-18 19:42 ` [PATCH net-next] ndisc: Check NS message length before access David Miller
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=50F93A6F.9020303@linux-ipv6.org \
--to=yoshfuji@linux-ipv6$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=netdev@vger$(echo .)kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox