Skip to content

Commit 97d4d39

Browse files
sbrivio-rhummakynes
authored andcommitted
netfilter: nft_set_pipapo: Actually validate intervals in fields after the first one
Embarrassingly, nft_pipapo_insert() checked for interval validity in the first field only. The start_p and end_p pointers were reset to key data from the first field at every iteration of the loop which was supposed to go over the set fields. Fixes: 3c4287f ("nf_tables: Add set type for arbitrary concatenation of ranges") Reported-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: Stefano Brivio <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent f2fc228 commit 97d4d39

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/netfilter/nft_set_pipapo.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,6 +1162,7 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,
11621162
struct nft_pipapo_match *m = priv->clone;
11631163
u8 genmask = nft_genmask_next(net);
11641164
struct nft_pipapo_field *f;
1165+
const u8 *start_p, *end_p;
11651166
int i, bsize_max, err = 0;
11661167

11671168
if (nft_set_ext_exists(ext, NFT_SET_EXT_KEY_END))
@@ -1202,9 +1203,9 @@ static int nft_pipapo_insert(const struct net *net, const struct nft_set *set,
12021203
}
12031204

12041205
/* Validate */
1206+
start_p = start;
1207+
end_p = end;
12051208
nft_pipapo_for_each_field(f, i, m) {
1206-
const u8 *start_p = start, *end_p = end;
1207-
12081209
if (f->rules >= (unsigned long)NFT_PIPAPO_RULE0_MAX)
12091210
return -ENOSPC;
12101211

0 commit comments

Comments
 (0)