diff options
-rw-r--r-- | net/ipv4/xfrm4_mode_beet.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/ipv4/xfrm4_mode_beet.c b/net/ipv4/xfrm4_mode_beet.c index f68dfd8a0f5c..d419e15d9803 100644 --- a/net/ipv4/xfrm4_mode_beet.c +++ b/net/ipv4/xfrm4_mode_beet.c | |||
@@ -52,7 +52,7 @@ static int xfrm4_beet_output(struct xfrm_state *x, struct sk_buff *skb) | |||
52 | 52 | ||
53 | ph = (struct ip_beet_phdr *)skb->h.raw; | 53 | ph = (struct ip_beet_phdr *)skb->h.raw; |
54 | ph->padlen = 4 - (optlen & 4); | 54 | ph->padlen = 4 - (optlen & 4); |
55 | ph->hdrlen = (optlen + ph->padlen + sizeof(*ph)) / 8; | 55 | ph->hdrlen = optlen / 8; |
56 | ph->nexthdr = top_iph->protocol; | 56 | ph->nexthdr = top_iph->protocol; |
57 | if (ph->padlen) | 57 | if (ph->padlen) |
58 | memset(ph + 1, IPOPT_NOP, ph->padlen); | 58 | memset(ph + 1, IPOPT_NOP, ph->padlen); |
@@ -85,7 +85,7 @@ static int xfrm4_beet_input(struct xfrm_state *x, struct sk_buff *skb) | |||
85 | ph = (struct ip_beet_phdr *)(skb->h.ipiph + 1); | 85 | ph = (struct ip_beet_phdr *)(skb->h.ipiph + 1); |
86 | 86 | ||
87 | phlen = sizeof(*ph) + ph->padlen; | 87 | phlen = sizeof(*ph) + ph->padlen; |
88 | optlen = ph->hdrlen * 8 - phlen; | 88 | optlen = ph->hdrlen * 8 + (IPV4_BEET_PHMAXLEN - phlen); |
89 | if (optlen < 0 || optlen & 3 || optlen > 250) | 89 | if (optlen < 0 || optlen & 3 || optlen > 250) |
90 | goto out; | 90 | goto out; |
91 | 91 | ||