]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
JSON: Fix replace command parser
authorPhil Sutter <phil@nwl.cc>
Fri, 1 Jun 2018 15:32:10 +0000 (17:32 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sun, 3 Jun 2018 09:47:22 +0000 (11:47 +0200)
This was completely broken. Yet another indicator the JSON API part of
testsuite is insufficient.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/parser_json.c

index 7971553651f2793dc2cbc66f0946162a978fa0da..9b7aef4b498cc32ba007cced335084c1e83fa52e 100644 (file)
@@ -2711,8 +2711,9 @@ static struct cmd *json_parse_cmd_replace(struct json_ctx *ctx,
        struct rule *rule;
        size_t index;
 
-       if (json_unpack_err(ctx, root, "{s:o}", "rule", &rule))
+       if (json_unpack_err(ctx, root, "{s:o}", "rule", &tmp))
                return NULL;
+       root = tmp;
 
        if (json_unpack_err(ctx, root, "{s:s, s:s, s:s, s:o}",
                            "family", &family,