Commit 6b96686e authored by Daniel Borkmann's avatar Daniel Borkmann Committed by Pablo Neira Ayuso

netfilter: nft_masq: fix uninitialized range in nft_masq_{ipv4, ipv6}_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: 9ba1f726 ("netfilter: nf_tables: add new nft_masq expression")
Signed-off-by: default avatarDaniel Borkmann <dborkman@redhat.com>
Acked-by: default avatarArturo Borrero Gonzalez <arturo.borrero.glez@gmail.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent d52fdbb7
...@@ -24,6 +24,7 @@ static void nft_masq_ipv4_eval(const struct nft_expr *expr, ...@@ -24,6 +24,7 @@ static void nft_masq_ipv4_eval(const struct nft_expr *expr,
struct nf_nat_range range; struct nf_nat_range range;
unsigned int verdict; unsigned int verdict;
memset(&range, 0, sizeof(range));
range.flags = priv->flags; range.flags = priv->flags;
verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum, verdict = nf_nat_masquerade_ipv4(pkt->skb, pkt->ops->hooknum,
......
...@@ -25,6 +25,7 @@ static void nft_masq_ipv6_eval(const struct nft_expr *expr, ...@@ -25,6 +25,7 @@ static void nft_masq_ipv6_eval(const struct nft_expr *expr,
struct nf_nat_range range; struct nf_nat_range range;
unsigned int verdict; unsigned int verdict;
memset(&range, 0, sizeof(range));
range.flags = priv->flags; range.flags = priv->flags;
verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out); verdict = nf_nat_masquerade_ipv6(pkt->skb, &range, pkt->out);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment