]> git.hungrycats.org Git - linux/commitdiff
[IPSEC]: Fix parsing of 16-bit ipcomp cpi.
authorJames Morris <jmorris@intercode.com.au>
Sat, 22 Mar 2003 17:13:14 +0000 (09:13 -0800)
committerDavid S. Miller <davem@nuts.ninka.net>
Sat, 22 Mar 2003 17:13:14 +0000 (09:13 -0800)
net/ipv4/xfrm_input.c

index 337677396020dbcb6eba3e010ab7ebb2dae7c258..f8d5012b6adaf9785c6e7ef46d098e87cb8e4fa6 100644 (file)
@@ -39,7 +39,7 @@ static int xfrm_parse_spi(struct sk_buff *skb, u32 *spi, u32 *seq)
        case IPPROTO_COMP:
                if (!pskb_may_pull(skb, 4))
                        return -EINVAL;
-               *spi = *(u16*)(skb->h.raw + 2);
+               *spi = ntohl(ntohs(*(u16*)(skb->h.raw + 2)));
                *seq = 0;
                return 0;
        default:
@@ -188,7 +188,7 @@ static int xfrm6_parse_spi(struct sk_buff *skb, u8 nexthdr, u32 *spi, u32 *seq)
        case IPPROTO_COMP:
                if (!pskb_may_pull(skb, 4))
                        return -EINVAL;
-               *spi = *(u16*)(skb->h.raw + 2);
+               *spi = ntohl(ntohs(*(u16*)(skb->h.raw + 2)));
                *seq = 0;
                return 0;
        default: