]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
parser_json: Fix synproxy object mss/wscale parsing
authorPhil Sutter <phil@nwl.cc>
Wed, 20 Sep 2023 17:40:11 +0000 (19:40 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 3 Nov 2023 11:23:37 +0000 (12:23 +0100)
commit d73e269f7bffc04b1163ffd16e0bc1689d4127d2 upstream.

The fields are 16 and 8 bits in size, introduce temporary variables to
parse into.

Fixes: f44ab88b1088e ("src: add synproxy stateful object support")
Signed-off-by: Phil Sutter <phil@nwl.cc>
src/parser_json.c

index 7bdd96450f6dcf46b4974eb47350ae5f0c0a4f26..aa15a7fcb239d7dfefe20719b8181fbbd6e3b3a6 100644 (file)
@@ -3331,7 +3331,7 @@ static struct cmd *json_parse_cmd_add_object(struct json_ctx *ctx,
 {
        const char *family, *tmp, *rate_unit = "packets", *burst_unit = "bytes";
        uint32_t l3proto = NFPROTO_UNSPEC;
-       int inv = 0, flags = 0, i;
+       int inv = 0, flags = 0, i, j;
        struct handle h = { 0 };
        struct obj *obj;
        json_t *jflags;
@@ -3518,11 +3518,12 @@ static struct cmd *json_parse_cmd_add_object(struct json_ctx *ctx,
        case CMD_OBJ_SYNPROXY:
                obj->type = NFT_OBJECT_SYNPROXY;
                if (json_unpack_err(ctx, root, "{s:i, s:i}",
-                                   "mss", &obj->synproxy.mss,
-                                   "wscale", &obj->synproxy.wscale)) {
+                                   "mss", &i, "wscale", &j)) {
                        obj_free(obj);
                        return NULL;
                }
+               obj->synproxy.mss = i;
+               obj->synproxy.wscale = j;
                obj->synproxy.flags |= NF_SYNPROXY_OPT_MSS;
                obj->synproxy.flags |= NF_SYNPROXY_OPT_WSCALE;
                if (!json_unpack(root, "{s:o}", "flags", &jflags)) {