Blame SOURCES/0041-json-init-parser-state-for-every-new-buffer-file.patch

4e0227
From 2b4da3af37ac10d96650da1b8642f82a3aa92e30 Mon Sep 17 00:00:00 2001
4e0227
From: Phil Sutter <psutter@redhat.com>
4e0227
Date: Sat, 20 Feb 2021 09:52:59 +0100
4e0227
Subject: [PATCH] json: init parser state for every new buffer/file
4e0227
4e0227
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1930873
4e0227
Upstream Status: nftables commit 267338ec39234
4e0227
4e0227
commit 267338ec392346ef55ed51509e5f8e8354d6c19a
4e0227
Author: Eric Garver <eric@garver.life>
4e0227
Date:   Fri Feb 19 10:11:26 2021 -0500
4e0227
4e0227
    json: init parser state for every new buffer/file
4e0227
4e0227
    Otherwise invalid error states cause subsequent json parsing to fail
4e0227
    when it should not.
4e0227
4e0227
    Signed-off-by: Eric Garver <eric@garver.life>
4e0227
    Signed-off-by: Phil Sutter <phil@nwl.cc>
4e0227
---
4e0227
 src/parser_json.c | 2 ++
4e0227
 1 file changed, 2 insertions(+)
4e0227
4e0227
diff --git a/src/parser_json.c b/src/parser_json.c
4e0227
index 986f128..662bb4b 100644
4e0227
--- a/src/parser_json.c
4e0227
+++ b/src/parser_json.c
4e0227
@@ -3777,6 +3777,7 @@ int nft_parse_json_buffer(struct nft_ctx *nft, const char *buf,
4e0227
 	};
4e0227
 	int ret;
4e0227
 
4e0227
+	parser_init(nft, nft->state, msgs, cmds, nft->top_scope);
4e0227
 	nft->json_root = json_loads(buf, 0, NULL);
4e0227
 	if (!nft->json_root)
4e0227
 		return -EINVAL;
4e0227
@@ -3805,6 +3806,7 @@ int nft_parse_json_filename(struct nft_ctx *nft, const char *filename,
4e0227
 	json_error_t err;
4e0227
 	int ret;
4e0227
 
4e0227
+	parser_init(nft, nft->state, msgs, cmds, nft->top_scope);
4e0227
 	nft->json_root = json_load_file(filename, 0, &err;;
4e0227
 	if (!nft->json_root)
4e0227
 		return -EINVAL;
4e0227
-- 
8ff5ad
2.31.1
4e0227