]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
expression: don't try to import empty string
authorFlorian Westphal <fw@strlen.de>
Thu, 27 Mar 2025 15:17:11 +0000 (16:17 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 29 Jul 2025 00:38:27 +0000 (02:38 +0200)
commit 8a9581d5d66ca2f920730441c82ac14fe9d9a427 upstream.

The bogon will trigger the assertion in mpz_import_data:
src/expression.c:418: constant_expr_alloc: Assertion `(((len) + (8) - 1) / (8)) > 0' failed.

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

index cfcf1ed9f4b8bee94c0991e44bf7cf4b429576c2..dd17f387842772b6766467014d30b52d302da8ab 100644 (file)
@@ -503,7 +503,7 @@ struct expr *constant_expr_alloc(const struct location *loc,
        expr->flags = EXPR_F_CONSTANT | EXPR_F_SINGLETON;
 
        mpz_init2(expr->value, len);
-       if (data != NULL)
+       if (data != NULL && len)
                mpz_import_data(expr->value, data, byteorder,
                                div_round_up(len, BITS_PER_BYTE));