]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: init cmd pointer for new on-stack context
authorFlorian Westphal <fw@strlen.de>
Fri, 4 Mar 2022 10:30:55 +0000 (11:30 +0100)
committerFlorian Westphal <fw@strlen.de>
Fri, 4 Mar 2022 11:14:39 +0000 (12:14 +0100)
else, this will segfault when trying to print the
"table 'x' doesn't exist" error message.

Signed-off-by: Florian Westphal <fw@strlen.de>
src/evaluate.c
tests/shell/testcases/chains/0041chain_binding_0

index 2732f5f49e064525ea89b4a9104f6699c5674981..07a4b0ad19b0513517282cbd74275cc34fb00911 100644 (file)
@@ -3425,6 +3425,7 @@ static int stmt_evaluate_chain(struct eval_ctx *ctx, struct stmt *stmt)
                        struct eval_ctx rule_ctx = {
                                .nft    = ctx->nft,
                                .msgs   = ctx->msgs,
+                               .cmd    = ctx->cmd,
                        };
                        struct handle h2 = {};
 
index 59bdbe9f0ba9dbe6ea797297f65ffeeae0b4ca64..4b541bb55c309bdef806e0ff0be43bd4c4e91a71 100755 (executable)
@@ -1,5 +1,11 @@
 #!/bin/bash
 
+# no table x, caused segfault in earlier nft releases
+$NFT insert rule inet x y handle 107 'goto { log prefix "MOO! "; }'
+if [ $? -ne 1 ]; then
+       exit 1
+fi
+
 set -e
 
 EXPECTED="table inet x {