diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/dccp/ipv4.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/net/dccp/ipv4.c b/net/dccp/ipv4.c index 6a2f1879e183..882c5c4de69e 100644 --- a/net/dccp/ipv4.c +++ b/net/dccp/ipv4.c | |||
@@ -196,8 +196,8 @@ static inline void dccp_do_pmtu_discovery(struct sock *sk, | |||
196 | static void dccp_v4_err(struct sk_buff *skb, u32 info) | 196 | static void dccp_v4_err(struct sk_buff *skb, u32 info) |
197 | { | 197 | { |
198 | const struct iphdr *iph = (struct iphdr *)skb->data; | 198 | const struct iphdr *iph = (struct iphdr *)skb->data; |
199 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + | 199 | const u8 offset = iph->ihl << 2; |
200 | (iph->ihl << 2)); | 200 | const struct dccp_hdr *dh = (struct dccp_hdr *)(skb->data + offset); |
201 | struct dccp_sock *dp; | 201 | struct dccp_sock *dp; |
202 | struct inet_sock *inet; | 202 | struct inet_sock *inet; |
203 | const int type = icmp_hdr(skb)->type; | 203 | const int type = icmp_hdr(skb)->type; |
@@ -207,7 +207,8 @@ static void dccp_v4_err(struct sk_buff *skb, u32 info) | |||
207 | int err; | 207 | int err; |
208 | struct net *net = dev_net(skb->dev); | 208 | struct net *net = dev_net(skb->dev); |
209 | 209 | ||
210 | if (skb->len < (iph->ihl << 2) + 8) { | 210 | if (skb->len < offset + sizeof(*dh) || |
211 | skb->len < offset + __dccp_basic_hdr_len(dh)) { | ||
211 | ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); | 212 | ICMP_INC_STATS_BH(net, ICMP_MIB_INERRORS); |
212 | return; | 213 | return; |
213 | } | 214 | } |