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

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