Skip to content

Commit

Permalink
netfilter: nf_tables: out-of-bound check in chain blob
Browse files Browse the repository at this point in the history
[ Upstream commit 08e42a0 ]

Add current size of rule expressions to the boundary check.

Fixes: 2c865a8 ("netfilter: nf_tables: add rule blob layout")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
ummakynes authored and gregkh committed Jun 14, 2023
1 parent 53cd8f5 commit d2d1527
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/netfilter/nf_tables_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -8921,7 +8921,7 @@ static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *cha
continue;
}

if (WARN_ON_ONCE(data + expr->ops->size > data_boundary))
if (WARN_ON_ONCE(data + size + expr->ops->size > data_boundary))
return -ENOMEM;

memcpy(data + size, expr, expr->ops->size);
Expand Down

0 comments on commit d2d1527

Please sign in to comment.