diff options
author | Florian Westphal <fw@strlen.de> | 2023-12-08 19:38:33 +0100 |
---|---|---|
committer | Florian Westphal <fw@strlen.de> | 2023-12-12 15:20:58 +0100 |
commit | 567937b5560fbcc7f6b74fb43c52e1cab2ac425a (patch) | |
tree | d0e9098d76e2718bc8ccdd1c23140395f8f285fb /src/evaluate.c | |
parent | 130060afa9f6f11e14ea5cf372545407179f16ac (diff) |
evaluate: fix bogus assertion failure with boolean datatype
The assertion is too strict, as found by afl++:
typeof iifname . ip saddr . meta ipsec
elements = { "eth0" . 10.1.1.2 . 1 }
meta ipsec is boolean (1 bit), but datasize of 1 is set at 8 bit.
Fixes: 22b750aa6dc9 ("src: allow use of base integer types as set keys in concatenations")
Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src/evaluate.c')
-rw-r--r-- | src/evaluate.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/evaluate.c b/src/evaluate.c index 715c398a..1b3e8097 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -4679,14 +4679,15 @@ static int set_expr_evaluate_concat(struct eval_ctx *ctx, struct expr **expr) "expressions", i->dtype->name); - if (i->dtype->size) - assert(i->len == i->dtype->size); - flags &= i->flags; ntype = concat_subtype_add(ntype, i->dtype->type); dsize_bytes = div_round_up(i->len, BITS_PER_BYTE); + + if (i->dtype->size) + assert(dsize_bytes == div_round_up(i->dtype->size, BITS_PER_BYTE)); + (*expr)->field_len[(*expr)->field_count++] = dsize_bytes; size += netlink_padded_len(i->len); } |