diff options
author | Florian Westphal <fw@strlen.de> | 2023-12-12 19:13:14 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-12-15 02:27:14 +0100 |
commit | ef10d65db278d77208e960d210a1f4f532ebb552 (patch) | |
tree | 354f10077f748e440f15b205071610c7c1f273b3 /include | |
parent | 8eeedce89d8bf0ad58da398782c2ca8a91d83a32 (diff) |
src: reject large raw payload and concat expressions
The kernel will reject this too, but unfortunately nft may try
to cram the data into the underlying libnftnl expr.
This causes heap corruption or
BUG: nld buffer overflow: want to copy 132, max 64
After:
Error: Concatenation of size 544 exceeds maximum size of 512
udp length . @th,0,512 . @th,512,512 { 47-63 . 0xe373135363130 . 0x33131303735353203 }
^^^^^^^^^
resp. same warning for an over-sized raw expression.
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/expression.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/include/expression.h b/include/expression.h index aede223d..809089c8 100644 --- a/include/expression.h +++ b/include/expression.h @@ -11,6 +11,9 @@ #include <json.h> #include <libnftnl/udata.h> +#define NFT_MAX_EXPR_LEN_BYTES (NFT_REG32_COUNT * sizeof(uint32_t)) +#define NFT_MAX_EXPR_LEN_BITS (NFT_MAX_EXPR_LEN_BYTES * BITS_PER_BYTE) + /** * enum expr_types * |