Skip to content

Commit

Permalink
netfilter: nft_masq: fix uninitialized range in nft_masq_{ipv4, ipv6}…
Browse files Browse the repository at this point in the history
…_eval

When transferring from the original range in nf_nat_masquerade_{ipv4,ipv6}()
we copy over values from stack in from min_proto/max_proto due to uninitialized
range variable in both, nft_masq_{ipv4,ipv6}_eval. As we only initialize
flags at this time from nft_masq struct, just zero out the rest.

Fixes: 9ba1f72 ("netfilter: nf_tables: add new nft_masq expression")
Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
Acked-by: Arturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
  • Loading branch information
Daniel Borkmann authored and Pablo Neira Ayuso committed Nov 10, 2014
1 parent d52fdbb commit 6b96686
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions net/ipv4/netfilter/nft_masq_ipv4.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ static void nft_masq_ipv4_eval(const struct nft_expr *expr,
struct nf_nat_range range;
unsigned int verdict;

memset(&range, 0, sizeof(range));
range.flags = priv->flags;

verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum,
Expand Down
1 change: 1 addition & 0 deletions net/ipv6/netfilter/nft_masq_ipv6.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ static void nft_masq_ipv6_eval(const struct nft_expr *expr,
struct nf_nat_range range;
unsigned int verdict;

memset(&range, 0, sizeof(range));
range.flags = priv->flags;

verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out);
Expand Down

0 comments on commit 6b96686

Please sign in to comment.