]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
json: fix type mismatch on "ct expect" json exporting
authorFernando Fernandez Mancera <ffmancera@riseup.net>
Fri, 13 Sep 2019 11:56:59 +0000 (13:56 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 13 Sep 2019 16:30:31 +0000 (18:30 +0200)
The size field in ct_expect struct should be parsed as json integer and not as
a string. Also, l3proto field is parsed as string and not as an integer. That
was causing a segmentation fault when exporting "ct expect" objects as json.

Fixes: 1dd08fcfa07a ("src: add ct expectations support")
Signed-off-by: Fernando Fernandez Mancera <ffmancera@riseup.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/json.c

index 6adc8012dc8e651e3a22c71b2b3e8296e54910ee..13a064249d90eb61e8c0cbe3bacf69cad8839da4 100644 (file)
@@ -333,7 +333,7 @@ static json_t *obj_print_json(const struct obj *obj)
                json_decref(tmp);
                break;
        case NFT_OBJECT_CT_EXPECT:
-               tmp = json_pack("{s:o, s:I, s:I, s:s, s:I}",
+               tmp = json_pack("{s:o, s:I, s:I, s:I, s:s}",
                                "protocol",
                                proto_name_json(obj->ct_expect.l4proto),
                                "dport", obj->ct_expect.dport,