From f2e3c291c8d1ca5879697abf87f96c5097cdf50b Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Tue, 30 Jun 2026 14:34:06 +0200 Subject: [PATCH] parser_json: allow statement stateful statement only in set elements JIRA: https://issues.redhat.com/browse/RHEL-190549 Upstream Status: nftables commit 85b5b051f0e64f106cee078fc6d66d0872770e79 commit 85b5b051f0e64f106cee078fc6d66d0872770e79 Author: Pablo Neira Ayuso Date: Tue Apr 1 09:49:48 2025 +0200 parser_json: allow statement stateful statement only in set elements Upfront reject of non stateful statements in set elements. Fixes: 07958ec53830 ("json: add set statement list support") Signed-off-by: Pablo Neira Ayuso Signed-off-by: Phil Sutter --- src/parser_json.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parser_json.c b/src/parser_json.c index 7b75a88..cfeef3c 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -2335,6 +2335,11 @@ static void json_parse_set_stmt_list(struct json_ctx *ctx, stmt_list_free(stmt_list); return; } + if (!(stmt->flags & STMT_F_STATEFUL)) { + stmt_free(stmt); + json_error(ctx, "Unsupported set statements array at index %zd failed.", index); + stmt_list_free(stmt_list); + } list_add(&stmt->list, head); head = &stmt->list; }