Skip to content

Commit 068d82e

Browse files
a3a3elummakynes
authored andcommitted
netfilter: nft_nat: correct length for loading protocol registers
The values in the protocol registers are two bytes wide. However, when parsing the register loads, the code currently uses the larger 16-byte size of a `union nf_inet_addr`. Change it to use the (correct) size of a `union nf_conntrack_man_proto` instead. Fixes: d07db98 ("netfilter: nf_tables: introduce nft_validate_register_load()") Signed-off-by: Jeremy Sowden <jeremy@azazel.net> Reviewed-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 37d9df2 commit 068d82e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/nft_nat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ static int nft_nat_init(const struct nft_ctx *ctx, const struct nft_expr *expr,
226226
priv->flags |= NF_NAT_RANGE_MAP_IPS;
227227
}
228228

229-
plen = sizeof_field(struct nf_nat_range, min_addr.all);
229+
plen = sizeof_field(struct nf_nat_range, min_proto.all);
230230
if (tb[NFTA_NAT_REG_PROTO_MIN]) {
231231
err = nft_parse_register_load(tb[NFTA_NAT_REG_PROTO_MIN],
232232
&priv->sreg_proto_min, plen);

0 commit comments

Comments
 (0)