]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser_json: Wrong check in json_parse_ct_timeout_policy()
authorPhil Sutter <phil@nwl.cc>
Wed, 13 Sep 2023 18:53:41 +0000 (20:53 +0200)
committerPhil Sutter <phil@nwl.cc>
Fri, 22 Sep 2023 08:55:25 +0000 (10:55 +0200)
The conditional around json_unpack() was meant to accept a missing
policy attribute. But the accidentally inverted check made the function
either ignore a given policy or access uninitialized memory.

Fixes: c82a26ebf7e9f ("json: Add ct timeout support")
Signed-off-by: Phil Sutter <phil@nwl.cc>
src/parser_json.c

index 6d8e5c625367b6850baf0b57fd2b2e1c129899d2..eec73034842443ca5c2f2735066666d02b30098a 100644 (file)
@@ -3415,7 +3415,7 @@ static int json_parse_ct_timeout_policy(struct json_ctx *ctx,
        json_t *tmp, *val;
        const char *key;
 
-       if (!json_unpack(root, "{s:o}", "policy", &tmp))
+       if (json_unpack(root, "{s:o}", "policy", &tmp))
                return 0;
 
        if (!json_is_object(tmp)) {