X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=net%2Fipv4%2Fnetfilter%2Fipt_multiport.c;h=7fdf41e22c86c7433c553852a6ff910ce28312b3;hb=c7b5ebbddf7bcd3651947760f423e3783bbe6573;hp=64e7999b049c6949caf0f32390b5d6d1e8d0a906;hpb=a2c21200f1c81b08cb55e417b68150bba439b646;p=linux-2.6.git diff --git a/net/ipv4/netfilter/ipt_multiport.c b/net/ipv4/netfilter/ipt_multiport.c index 64e7999b0..7fdf41e22 100644 --- a/net/ipv4/netfilter/ipt_multiport.c +++ b/net/ipv4/netfilter/ipt_multiport.c @@ -54,7 +54,7 @@ match(const struct sk_buff *skb, int offset, int *hotdrop) { - u16 ports[2]; + u16 _ports[2], *pptr; const struct ipt_multiport *multiinfo = matchinfo; /* Must not be a fragment. */ @@ -63,18 +63,21 @@ match(const struct sk_buff *skb, /* Must be big enough to read ports (both UDP and TCP have them at the start). */ - if (skb_copy_bits(skb, skb->nh.iph->ihl*4, ports, sizeof(ports)) < 0) { + pptr = skb_header_pointer(skb, skb->nh.iph->ihl * 4, + sizeof(_ports), &_ports[0]); + if (pptr == NULL) { /* We've been asked to examine this packet, and we - can't. Hence, no choice but to drop. */ - duprintf("ipt_multiport:" - " Dropping evil offset=0 tinygram.\n"); - *hotdrop = 1; - return 0; + * can't. Hence, no choice but to drop. + */ + duprintf("ipt_multiport:" + " Dropping evil offset=0 tinygram.\n"); + *hotdrop = 1; + return 0; } return ports_match(multiinfo->ports, multiinfo->flags, multiinfo->count, - ntohs(ports[0]), ntohs(ports[1])); + ntohs(pptr[0]), ntohs(pptr[1])); } /* Called when user tries to insert an entry of this type. */