]> git.ipfire.org Git - thirdparty/nftables.git/commit
mnl: catch bogus expressions before crashing
authorFlorian Westphal <fw@strlen.de>
Thu, 5 Jun 2025 22:20:28 +0000 (00:20 +0200)
committerFlorian Westphal <fw@strlen.de>
Thu, 12 Jun 2025 12:55:41 +0000 (14:55 +0200)
commitd3339f9e35ee4dddf290fcc3e9cc63dac8cb836a
tree4da7faecbb36b1f2554223277ecfcb7374f012bf
parent3db0baf80ceaa09735873221a9acacc145673481
mnl: catch bogus expressions before crashing

We can't recover from errors here, but we can abort with a more
precise reason than 'segmentation fault', or stack corruptions
that get caught way later, or not at all.

expr->value is going to be read, we can't cope with other expression
types here.

We will copy to stack buffer of IFNAMSIZ size, abort if we would
overflow.

Check there is a NUL byte present too.
This is a preemptive patch, I've seen one crash in this area but
no reproducer yet.

Signed-off-by: Florian Westphal <fw@strlen.de>
Reviewed-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/mnl.c