Merge "nf: xt_socket: Fix out-of-bounds in xt_socket_lookup_slow_v{4,6}"

This commit is contained in:
Linux Build Service Account 2018-03-28 15:28:09 -07:00 committed by Gerrit - the friendly Code Review server
commit 9896df099c

View file

@ -158,10 +158,13 @@ struct sock *xt_socket_lookup_slow_v4(struct net *net,
#endif
if (iph->protocol == IPPROTO_UDP || iph->protocol == IPPROTO_TCP) {
struct udphdr _hdr, *hp;
struct udphdr *hp;
struct tcphdr _hdr;
hp = skb_header_pointer(skb, ip_hdrlen(skb),
sizeof(_hdr), &_hdr);
iph->protocol == IPPROTO_UDP ?
sizeof(*hp) : sizeof(_hdr),
&_hdr);
if (hp == NULL)
return NULL;
@ -360,9 +363,11 @@ struct sock *xt_socket_lookup_slow_v6(struct net *net,
}
if (tproto == IPPROTO_UDP || tproto == IPPROTO_TCP) {
struct udphdr _hdr, *hp;
struct udphdr *hp;
struct tcphdr _hdr;
hp = skb_header_pointer(skb, thoff, sizeof(_hdr), &_hdr);
hp = skb_header_pointer(skb, thoff, tproto == IPPROTO_UDP ?
sizeof(*hp) : sizeof(_hdr), &_hdr);
if (hp == NULL)
return NULL;