diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2025-03-27 16:32:16 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2025-03-27 21:39:03 +0100 |
commit | ab4ad2e12a059b31c4e65a8900e33bc88f2f5531 (patch) | |
tree | 0bed46e56dba025827e3255f13373cf22e649309 /src | |
parent | 8cec28ac807fdc05cd16e6f621ad8452ab083190 (diff) |
json: disallow empty concatenation
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/parser_json.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/parser_json.c b/src/parser_json.c index dd085d78..04d76274 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -1729,6 +1729,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; |