From: Eric Garver Date: Tue, 10 Sep 2019 13:46:15 +0000 (-0400) Subject: parser_json: fix crash on insert rule to bad references X-Git-Tag: v0.9.3~73 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e64c42b19a9e50009b4d8877aeee95edb6818990;p=thirdparty%2Fnftables.git parser_json: fix crash on insert rule to bad references Pass the location via the handle so the error leg in erec_print_list() can reference it. Applies to invalid references to tables, chains, and indexes. Fixes: 586ad210368b ("libnftables: Implement JSON parser") Signed-off-by: Eric Garver Signed-off-by: Phil Sutter --- diff --git a/src/parser_json.c b/src/parser_json.c index 8ca07d71..183d9c97 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -3258,7 +3258,11 @@ static struct cmd *json_parse_cmd_add(struct json_ctx *ctx, static struct cmd *json_parse_cmd_replace(struct json_ctx *ctx, json_t *root, enum cmd_ops op) { - struct handle h = { 0 }; + struct handle h = { + .table.location = *int_loc, + .chain.location = *int_loc, + .index.location = *int_loc, + }; json_t *tmp, *value; const char *family; struct rule *rule;