]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
datatype: Fix boolean type on Big Endian
authorPhil Sutter <phil@nwl.cc>
Wed, 8 Oct 2025 21:19:08 +0000 (23:19 +0200)
committerPhil Sutter <phil@nwl.cc>
Thu, 23 Oct 2025 20:48:50 +0000 (22:48 +0200)
Pass a reference to a variable with correct size when creating the
expression, otherwise mpz_import_data() will read only the always zero
upper byte on Big Endian hosts.

Fixes: afb6a8e66a111 ("datatype: clamp boolean value to 0 and 1")
Signed-off-by: Phil Sutter <phil@nwl.cc>
src/datatype.c

index 956ce2ac0a97bc38d5f302830adc7b6635d3d198..7effeb33208e766c04728f64576f21c1e9c73247 100644 (file)
@@ -1559,7 +1559,7 @@ static struct error_record *boolean_type_parse(struct parse_ctx *ctx,
                                               struct expr **res)
 {
        struct error_record *erec;
-       int num;
+       uint8_t num;
 
        erec = integer_type_parse(ctx, sym, res);
        if (erec)