We have to clone the payload expression before attaching it to the lhs
of the relational expression, this payload expression is located at the
lhs of the binary operation that is released thereafter.
Fixes: 39f15c2 ("nft: support listing expressions that use non-byte header fields")
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
} else if (binop->op == OP_AND &&
binop->left->ops->type == EXPR_PAYLOAD &&
binop->right->ops->type == EXPR_VALUE) {
- struct expr *payload = expr->left->left;
- struct expr *mask = expr->left->right;
+ struct expr *payload = binop->left;
+ struct expr *mask = binop->right;
/*
* This *might* be a payload match testing header fields that
assert(expr->left->ops->type == EXPR_BINOP);
assert(binop->left == payload);
- expr->left = payload;
+ expr->left = expr_get(payload);
expr_free(binop);
}
}