[nft,1/5] src: segtree: use value expression length

Message ID 20180111153024.25198-3-fw@strlen.de
State Accepted
Delegated to: Florian Westphal
Headers show
  • [nft,1/5] src: segtree: use value expression length
Related show

Commit Message

Florian Westphal Jan. 11, 2018, 3:30 p.m.
In case of EXPR_MAPPING, expr->len is 0, we need to use
the length of the key instead.

Without this we can get assertion failure later on:
nft: netlink_delinearize.c:1484: binop_adjust_one: Assertion `value->len >= binop->right->len' failed.

Signed-off-by: Florian Westphal <fw@strlen.de>
 src/segtree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


diff --git a/src/segtree.c b/src/segtree.c
index 8d36cc9b0d65..1f0d1a4ba7ae 100644
--- a/src/segtree.c
+++ b/src/segtree.c
@@ -697,7 +697,7 @@  void interval_map_decompose(struct expr *set)
 			struct expr *tmp;
 			tmp = constant_expr_alloc(&low->location, low->dtype,
-						  low->byteorder, low->len,
+						  low->byteorder, expr_value(low)->len,
 			mpz_add(range, range, expr_value(low)->value);