netfilter: nf_tables: out-of-bound check in chain blob
[ Upstream commit 08e42a0d3ad30f276f9597b591f975971a1b0fcf ]
Add current size of rule expressions to the boundary check.
Fixes: 2c865a8a28
("netfilter: nf_tables: add rule blob layout")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
fea199dbf6
commit
65f2def206
@ -8723,7 +8723,7 @@ static int nf_tables_commit_chain_prepare(struct net *net, struct nft_chain *cha
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WARN_ON_ONCE(data + expr->ops->size > data_boundary))
|
if (WARN_ON_ONCE(data + size + expr->ops->size > data_boundary))
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
memcpy(data + size, expr, expr->ops->size);
|
memcpy(data + size, expr, expr->ops->size);
|
||||||
|
Loading…
Reference in New Issue
Block a user