]> git.ipfire.org Git - thirdparty/nftables.git/commit
parser_json: Fix error reporting for invalid syntax
authorPhil Sutter <phil@nwl.cc>
Wed, 1 Sep 2021 14:41:44 +0000 (16:41 +0200)
committerPhil Sutter <phil@nwl.cc>
Wed, 1 Sep 2021 15:22:17 +0000 (17:22 +0200)
commit9fe5d1bc18cfaed2ecf717e3dd9a97ff5b0e183c
tree1c255dddf2d4b24454e9f0a0461e9cfb04ebd506
parent567ea4774e13b1f3b06f42c74b9bd32453d70164
parser_json: Fix error reporting for invalid syntax

Errors emitted by the JSON parser caused BUG() in erec_print() due to
input descriptor values being bogus.

Due to lack of 'include' support, JSON parser uses a single input
descriptor only and it lived inside the json_ctx object on stack of
nft_parse_json_*() functions.

By the time errors are printed though, that scope is not valid anymore.
Move the static input descriptor object to avoid this.

Fixes: 586ad210368b7 ("libnftables: Implement JSON parser")
Signed-off-by: Phil Sutter <phil@nwl.cc>
src/parser_json.c