From: Pablo Neira Ayuso Date: Wed, 10 Jan 2024 17:20:47 +0000 (+0100) Subject: evaluate: do not fetch next expression on runaway number of concatenation components X-Git-Tag: v1.0.6.1~256 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b6884541ecfc8cce8003906af7e32894fc537492;p=thirdparty%2Fnftables.git evaluate: do not fetch next expression on runaway number of concatenation components commit 955bb6d31c90453e43043346c917646ddc4e5c4e upstream. 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 --- diff --git a/src/evaluate.c b/src/evaluate.c index 60d8cf9d..f8bc149d 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -1502,8 +1502,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); } if (size > NFT_MAX_EXPR_LEN_BITS)