mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
netfilter: nf_tables: bail out on mismatching dynset and set expressions
[ Upstream commit3701cd390f
] If dynset expressions provided by userspace is larger than the declared set expressions, then bail out. Fixes:48b0ae046e
("netfilter: nftables: netlink support for several set element expressions") Reported-by: Xingyuan Mo <hdthky0@gmail.com> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
c9704c2619
commit
96f8654b70
1 changed files with 9 additions and 4 deletions
|
@ -279,10 +279,15 @@ static int nft_dynset_init(const struct nft_ctx *ctx,
|
|||
priv->expr_array[i] = dynset_expr;
|
||||
priv->num_exprs++;
|
||||
|
||||
if (set->num_exprs &&
|
||||
dynset_expr->ops != set->exprs[i]->ops) {
|
||||
err = -EOPNOTSUPP;
|
||||
goto err_expr_free;
|
||||
if (set->num_exprs) {
|
||||
if (i >= set->num_exprs) {
|
||||
err = -EINVAL;
|
||||
goto err_expr_free;
|
||||
}
|
||||
if (dynset_expr->ops != set->exprs[i]->ops) {
|
||||
err = -EOPNOTSUPP;
|
||||
goto err_expr_free;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue