From: Pablo Neira Ayuso Date: Thu, 27 Mar 2025 15:32:16 +0000 (+0100) Subject: json: disallow empty concatenation X-Git-Tag: v1.0.6.1~113 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=087dd173771463cd3c7489ed97a2eb16974dbe8f;p=thirdparty%2Fnftables.git json: disallow empty concatenation commit ab4ad2e12a059b31c4e65a8900e33bc88f2f5531 upstream. Disallow empty concatenation in set declaration in json. internal:0:0-0: Error: Empty concatenation internal:0:0-0: Error: Invalid set type. internal:0:0-0: Error: Parsing command array at index 1 failed. Joint work with Florian Westphal. Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/parser_json.c b/src/parser_json.c index c7649ccf..51ce2135 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -1670,6 +1670,13 @@ static struct expr *json_parse_dtype_expr(struct json_ctx *ctx, json_t *root) } compound_expr_add(expr, i); } + + if (list_empty(&expr->expressions)) { + json_error(ctx, "Empty concatenation"); + expr_free(expr); + return NULL; + } + return expr; } else if (json_is_object(root)) { const char *key;