Skip to content

Commit

Permalink
netfilter: xt_HMARK: potential NULL dereference in get_inner_hdr()
Browse files Browse the repository at this point in the history
There is a typo in the error checking and "&&" was used instead of "||".
If skb_header_pointer() returns NULL then it leads to a NULL
dereference.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Hans Schillstrom <hans.schillstrom@ericsson.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Dan Carpenter authored and Pablo Neira Ayuso committed May 16, 2012
1 parent 1f27e25 commit 5861811
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/xt_HMARK.c
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ static int get_inner_hdr(const struct sk_buff *skb, int iphsz, int *nhoff)

/* Not enough header? */
icmph = skb_header_pointer(skb, *nhoff + iphsz, sizeof(_ih), &_ih);
if (icmph == NULL && icmph->type > NR_ICMP_TYPES)
if (icmph == NULL || icmph->type > NR_ICMP_TYPES)
return 0;

/* Error message? */
Expand Down

0 comments on commit 5861811

Please sign in to comment.