]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
src: json: fix constant parsing on bigendian
authorFlorian Westphal <fw@strlen.de>
Wed, 14 Aug 2019 11:45:19 +0000 (13:45 +0200)
committerFlorian Westphal <fw@strlen.de>
Wed, 14 Aug 2019 13:28:00 +0000 (15:28 +0200)
json restore is broken on big-endian because we errounously
passed uint8_t with 64 bit size indicator.

On bigendian, this causes all values to get shifted by 56 bit,
this will then cause the eval step to bail because all values
are outside of the 8bit 0-255 protocol range.

Signed-off-by: Florian Westphal <fw@strlen.de>
Acked-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/parser_json.c

index d42bab704f7cde1884330c0027a240088e27902d..a969bd4c3676b393508d0f103426c37d1dd7a6a7 100644 (file)
@@ -304,7 +304,7 @@ static struct expr *json_parse_constant(struct json_ctx *ctx, const char *name)
                return constant_expr_alloc(int_loc,
                                           constant_tbl[i].dtype,
                                           BYTEORDER_HOST_ENDIAN,
-                                          8 * BITS_PER_BYTE,
+                                          BITS_PER_BYTE,
                                           &constant_tbl[i].data);
        }
        json_error(ctx, "Unknown constant '%s'.", name);