From: Phil Sutter Date: Mon, 21 Oct 2019 14:20:10 +0000 (+0200) Subject: parser_json: Fix checking of parse_policy() return code X-Git-Tag: v0.9.3~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00487d5fe3ece179e61124ee62449f4ad7d1918e;p=thirdparty%2Fnftables.git parser_json: Fix checking of parse_policy() return code The function was changed to return an expression or NULL but error checking wasn't adjusted while doing so. Fixes: dba4a9b4b5fe2 ("src: allow variable in chain policy") Signed-off-by: Phil Sutter Acked-by: Pablo Neira Ayuso --- diff --git a/src/parser_json.c b/src/parser_json.c index 55dbc177c..fe0c5df98 100644 --- a/src/parser_json.c +++ b/src/parser_json.c @@ -2630,7 +2630,7 @@ static struct cmd *json_parse_cmd_add_chain(struct json_ctx *ctx, json_t *root, chain->dev = xstrdup(chain->dev); if (!json_unpack(root, "{s:s}", "policy", &policy)) { chain->policy = parse_policy(policy); - if (chain->policy < 0) { + if (!chain->policy) { json_error(ctx, "Unknown policy '%s'.", policy); chain_free(chain); return NULL;