summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2025-03-27 16:32:16 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2025-07-29 02:38:27 +0200
commit087dd173771463cd3c7489ed97a2eb16974dbe8f (patch)
treec7350e87ec85e67e9542b9698f03f2ba0aed7ea0
parent2e9046b8b018dbf8da8608b00734c762c1aeef17 (diff)
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 <pablo@netfilter.org>
-rw-r--r--src/parser_json.c7
1 files changed, 7 insertions, 0 deletions
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;