parser_json: reject empty jump/goto chain
Pablo Neira Ayuso
maintainerPATCH 1/1 parser_json: reject empty jump/goto chain
When parsing a verdict map json where element jumps to chain represented as empty string.
internal:0:0-0: Error: Parsing list expression item at index 0 failed. internal:0:0-0: Error: Invalid set elem at index 0. internal:0:0-0: Error: Invalid set elem expression. internal:0:0-0: Error: Parsing command array at index 2 failed.
Fixes 586ad210368b ("libnftables: Implement JSON parser")
Signed-off-by Pablo Neira Ayuso <[email protected]>
---
This is extra, on top of Florian's fix to address this from the evalution step, not a replacement.
src/parser_json.c | 3 +++ 1 file changed, 3 insertions(+)
src/parser_json.c +3 -0
@@ -1350,6 +1350,9 @@ static struct expr *json_parse_verdict_expr(struct json_ctx *ctx, json_unpack_err(ctx, root, "{s:s}", "target", &chain))return NULL ; +if (!chain || chain[0 ] =='\0' ) +return NULL ; +return verdict_expr_alloc (int_loc, verdict_tbl[i].verdict,json_alloc_chain_expr (chain)); }
Signature · 1 line
2.30.2