]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
eval: prohibit variable sized types in concat expressions
authorPatrick McHardy <kaber@trash.net>
Tue, 2 Jun 2015 10:16:42 +0000 (12:16 +0200)
committerPatrick McHardy <kaber@trash.net>
Tue, 2 Jun 2015 11:03:58 +0000 (13:03 +0200)
Since we need to calculate the length of the entire concat type, we can
not support variable sized types where the length can't be determined
by the type.

This only affects base types since all higher types include a length.

Signed-off-by: Patrick McHardy <kaber@trash.net>
src/evaluate.c

index e260a80340f638a96093c564ce4625c6f08ea583..d99b38f4457e0560d21dccb052e371a015cc9dcf 100644 (file)
@@ -620,6 +620,13 @@ static int expr_evaluate_concat(struct eval_ctx *ctx, struct expr **expr)
                                                 "expecting %s",
                                                 dtype->desc);
 
+               if (dtype == NULL && i->dtype->size == 0)
+                       return expr_binary_error(ctx->msgs, i, *expr,
+                                                "can not use variable sized "
+                                                "data types (%s) in concat "
+                                                "expressions",
+                                                i->dtype->name);
+
                tmp = concat_subtype_lookup(type, --off);
                expr_set_context(&ctx->ectx, tmp, tmp->size);