evaluate: init cmd pointer for new on-stack context
Florian Westphal
maintainerPATCH 1/1 evaluate: init cmd pointer for new on-stack context
else, this will segfault when trying to print the
"table 'x' doesn't exist" error message.
--- src/evaluate.c | 1 + tests/shell/testcases/chains/0041chain_binding_0 | 6 ++++++ 2 files changed, 7 insertions(+)
src/evaluate.c +1 -0
@@ -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 = {};
tests/shell/testcases/chains/0041chain_binding_0 +6 -0
@@ -1,5 +1,11 @@ #!/bin/bash +# no table z, 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 {
Signature · 1 line
2.34.1
Pablo Neira Ayuso
maintainerQuoted 2 lines · Florian Westphal
else, this will segfault when trying to print the
"table 'x' doesn't exist" error message.
LGTM, thanks. One nitpick below:
Quoted 23 lines
Signed-off-by Florian Westphal <[email protected]>--- src/evaluate.c | 1 + tests/shell/testcases/chains/0041chain_binding_0 | 6 ++++++ 2 files changed, 7 insertions(+)src/evaluate.c +1
-0@@ -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 = {};tests/shell/testcases/chains/0041chain_binding_0 +0
-0
tests/shell/testcases/chains/0041chain_binding_0 line 3
Quoted 3 lines
tests/shell/testcases/chains/0041chain_binding_0 +1
-0@@ -1,5 +1,11 @@ #!/bin/bash +# no table z, caused segfault in earlier nft releases
this is no table x?
Quoted 11 lines
tests/shell/testcases/chains/0041chain_binding_0 +5
-0+$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 {Signature · 1 line
2.34.1
Florian Westphal
maintainerQuoted 5 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal
else, this will segfault when trying to print the
"table 'x' doesn't exist" error message.LGTM, thanks. One nitpick below:
I've pushed it out with the corrected comment.
Phil Sutter
reviewerQuoted 5 lines · Pablo Neira Ayuso
Quoted 2 lines · Florian Westphal
else, this will segfault when trying to print the
"table 'x' doesn't exist" error message.LGTM, thanks. One nitpick below:
This also fixes the segfault I was trying to avoid with my patch for string_misspell_update(). I had definitely tried Florian's solution, but it didn't work for me. Guess there's a bug in my test env or something. :(
Thanks, Phil