diff options
author | Wei Yongjun <yjwei@cn.fujitsu.com> | 2008-07-26 06:59:11 -0400 |
---|---|---|
committer | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2008-07-26 06:59:11 -0400 |
commit | 860239c56bbc7c830bdbcec93b140f22a5a5219b (patch) | |
tree | 52de988257064b33441f3a8341f6f2fac48a3fe4 /net/dccp | |
parent | 18e1d836002ad970f42736bad09b7be9cfe99545 (diff) |
dccp: Add check for truncated ICMPv6 DCCP error packets
This patch adds a minimum-length check for ICMPv6 packets, as per the previous
patch for ICMPv4 payloads.
Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/ipv6.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c index 25826b1bf685..5e1ee0da2c40 100644 --- a/net/dccp/ipv6.c +++ b/net/dccp/ipv6.c | |||
@@ -96,6 +96,12 @@ static void dccp_v6_err(struct sk_buff *skb, struct inet6_skb_parm *opt, | |||
96 | __u64 seq; | 96 | __u64 seq; |
97 | struct net *net = dev_net(skb->dev); | 97 | struct net *net = dev_net(skb->dev); |
98 | 98 | ||
99 | if (skb->len < offset + sizeof(*dh) || | ||
100 | skb->len < offset + __dccp_basic_hdr_len(dh)) { | ||
101 | ICMP6_INC_STATS_BH(__in6_dev_get(skb->dev), ICMP6_MIB_INERRORS); | ||
102 | return; | ||
103 | } | ||
104 | |||
99 | sk = inet6_lookup(net, &dccp_hashinfo, | 105 | sk = inet6_lookup(net, &dccp_hashinfo, |
100 | &hdr->daddr, dh->dccph_dport, | 106 | &hdr->daddr, dh->dccph_dport, |
101 | &hdr->saddr, dh->dccph_sport, inet6_iif(skb)); | 107 | &hdr->saddr, dh->dccph_sport, inet6_iif(skb)); |