]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: do not fetch next expression on runaway number of concatenation components
authorPablo Neira Ayuso <pablo@netfilter.org>
Wed, 10 Jan 2024 17:20:47 +0000 (18:20 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 12 Jan 2024 11:19:55 +0000 (12:19 +0100)
If this is the last expression, then the runaway flag is set on and
evaluation bails in the next iteration, do not fetch next list element
which refers to the list head.

I found this by code inspection, I could not trigger any crash with this
one.

Fixes: ae1d54d1343f ("evaluate: do not crash on runaway number of concatenation components")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c

index 78732c6ee2d37d38692a9bc8d7badc76dec9c7f5..eb55f6c0a429375a64c42a1769466796e8cdab48 100644 (file)
@@ -1653,8 +1653,8 @@ static int expr_evaluate_concat(struct eval_ctx *ctx, struct expr **expr)
                if (key && expressions) {
                        if (list_is_last(&key->list, expressions))
                                runaway = true;
-
-                       key = list_next_entry(key, list);
+                       else
+                               key = list_next_entry(key, list);
                }
 
                ctx->inner_desc = NULL;