diff options
author | Eric Garver <eric@garver.life> | 2021-02-19 10:11:26 -0500 |
---|---|---|
committer | Phil Sutter <phil@nwl.cc> | 2021-02-19 16:42:11 +0100 |
commit | 267338ec392346ef55ed51509e5f8e8354d6c19a (patch) | |
tree | 6e167b48290447317d27d921bef8cab608e23a8c /src/parser_json.c | |
parent | fb544ce224ab56ef789e926227e47ac537cf9a20 (diff) |
json: init parser state for every new buffer/file
Otherwise invalid error states cause subsequent json parsing to fail
when it should not.
Signed-off-by: Eric Garver <eric@garver.life>
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/parser_json.c')
-rw-r--r-- | src/parser_json.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/parser_json.c b/src/parser_json.c index 2d132caf..ddbf9d9c 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; |