summaryrefslogtreecommitdiffstats
path: root/src/parser_json.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2019-02-26 22:13:39 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2019-02-27 11:25:14 +0100
commitdc6a6e83b47fc7078a061350cd2b111cb2adec14 (patch)
tree9ce0c01f4f92c314e168d826e49b2c133c37041c /src/parser_json.c
parenta0da4c5bbf0d741fb815a977c945afe1b9a0739f (diff)
parser_json: Duplicate chain name when parsing jump verdict
Since verdict expression frees the chain name, pass a newly allocated string to it. Otherwise double free happens because json_decref() frees the string property value as well. Fixes: d1057a5feb5fd ("JSON: Simplify verdict statement parsing") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/parser_json.c')
-rw-r--r--src/parser_json.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/parser_json.c b/src/parser_json.c
index d00cf422..78214f65 100644
--- a/src/parser_json.c
+++ b/src/parser_json.c
@@ -1075,7 +1075,8 @@ static struct expr *json_parse_verdict_expr(struct json_ctx *ctx,
return NULL;
return verdict_expr_alloc(int_loc,
- verdict_tbl[i].verdict, chain);
+ verdict_tbl[i].verdict,
+ chain ? xstrdup(chain) : NULL);
}
json_error(ctx, "Unknown verdict '%s'.", type);
return NULL;