Skip to content

Commit

Permalink
netfilter: nft_exthdr: call ipv6_find_hdr() with explicitly initializ…
Browse files Browse the repository at this point in the history
…ed offset

In nft's nft_exthdr_eval() routine we process IPv6 extension header
through invoking ipv6_find_hdr(), but we call it with an uninitialized
offset variable that contains some stack value. In ipv6_find_hdr()
we then test if the value of offset != 0 and call skb_header_pointer()
on that offset in order to map struct ipv6hdr into it. Fix it up by
initializing offset to 0 as it was probably intended to be.

Fixes: 9651851 ("netfilter: add nftables")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Cc: Hannes Frederic Sowa <hannes@stressinduktion.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
borkmann authored and ummakynes committed Dec 20, 2013
1 parent 45c2aff commit 540436c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/nft_exthdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ static void nft_exthdr_eval(const struct nft_expr *expr,
{
struct nft_exthdr *priv = nft_expr_priv(expr);
struct nft_data *dest = &data[priv->dreg];
unsigned int offset;
unsigned int offset = 0;
int err;

err = ipv6_find_hdr(pkt->skb, &offset, priv->type, NULL, NULL);
Expand Down

0 comments on commit 540436c

Please sign in to comment.