From: Pablo Neira Ayuso Date: Thu, 25 Oct 2018 17:35:10 +0000 (+0200) Subject: evaluate: stmt_evaluate_map() needs right hand side evaluation too X-Git-Tag: v0.9.1~203 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7b6f95df9eb6d9f51b2e99ba335e7b57e9a451df;p=thirdparty%2Fnftables.git evaluate: stmt_evaluate_map() needs right hand side evaluation too The data side of the mapping that is dynamically generated needs to be evaluated as well. Fixes: 0e90798e9812 ("src: simplify map statement") Signed-off-by: Pablo Neira Ayuso --- diff --git a/src/evaluate.c b/src/evaluate.c index dbeedc95..d023f47a 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -2773,12 +2773,20 @@ static int stmt_evaluate_map(struct eval_ctx *ctx, struct stmt *stmt) if (stmt->map.key->comment != NULL) return expr_error(ctx->msgs, stmt->map.key, "Key expression comments are not supported"); + + if (stmt_evaluate_arg(ctx, stmt, + stmt->map.set->set->datatype, + stmt->map.set->set->datalen, + stmt->map.set->set->datatype->byteorder, + &stmt->map.data->key) < 0) + return -1; if (expr_is_constant(stmt->map.data)) return expr_error(ctx->msgs, stmt->map.data, "Data expression can not be constant"); if (stmt->map.data->comment != NULL) return expr_error(ctx->msgs, stmt->map.data, "Data expression comments are not supported"); + if (stmt->map.stmt) { if (stmt_evaluate(ctx, stmt->map.stmt) < 0) return -1;