All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH nft] json: init parser state for every new buffer/file
@ 2021-02-19 15:11 Eric Garver
  2021-02-19 15:46 ` Phil Sutter
  0 siblings, 1 reply; 2+ messages in thread
From: Eric Garver @ 2021-02-19 15:11 UTC (permalink / raw)
  To: netfilter-devel; +Cc: Phil Sutter

Otherwise invalid error states cause subsequent json parsing to fail
when it should not.

Signed-off-by: Eric Garver <eric@garver.life>
---
 src/parser_json.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/parser_json.c b/src/parser_json.c
index 2d132caf529c..ddbf9d9c027b 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -3893,6 +3893,7 @@ int nft_parse_json_buffer(struct nft_ctx *nft, const char *buf,
 	};
 	int ret;
 
+	parser_init(nft, nft->state, msgs, cmds, nft->top_scope);
 	nft->json_root = json_loads(buf, 0, NULL);
 	if (!nft->json_root)
 		return -EINVAL;
@@ -3921,6 +3922,7 @@ int nft_parse_json_filename(struct nft_ctx *nft, const char *filename,
 	json_error_t err;
 	int ret;
 
+	parser_init(nft, nft->state, msgs, cmds, nft->top_scope);
 	nft->json_root = json_load_file(filename, 0, &err);
 	if (!nft->json_root)
 		return -EINVAL;
-- 
2.29.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-02-19 15:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-19 15:11 [PATCH nft] json: init parser state for every new buffer/file Eric Garver
2021-02-19 15:46 ` Phil Sutter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.