]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
evaluate: reject unsupported expressions in payload statement for bitfields
authorPablo Neira Ayuso <pablo@netfilter.org>
Fri, 28 Feb 2025 14:57:18 +0000 (15:57 +0100)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 13 Aug 2025 16:04:16 +0000 (18:04 +0200)
commit de447e248cce3ca3fd7040c386ac798c35721415 upstream.

The payload statement evaluation pretends that it can handle any
expression for bitfields, but the existing evaluation code only knows
how to handle value expression.

Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/evaluate.c

index de5ada83d5f68b2ab98ae7563f5984b0535efebf..ae5b07bab10ac07818f5ad66b0f4c99bdd8e824e 100644 (file)
@@ -3202,7 +3202,8 @@ static int stmt_evaluate_payload(struct eval_ctx *ctx, struct stmt *stmt)
                        mpz_lshift_ui(stmt->payload.val->value, shift_imm);
                break;
        default:
-               break;
+               return expr_error(ctx->msgs, stmt->payload.val,
+                                 "payload statement for this expression is not supported");
        }
 
        masklen = payload_byte_size * BITS_PER_BYTE;