diff options
-rw-r--r-- | src/evaluate.c | 5 | ||||
-rw-r--r-- | tests/shell/testcases/bogons/nft-f/payload_expr_unaligned_store | 1 |
2 files changed, 6 insertions, 0 deletions
diff --git a/src/evaluate.c b/src/evaluate.c index 3b366166..68cfd776 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -3188,6 +3188,11 @@ static int stmt_evaluate_payload(struct eval_ctx *ctx, struct stmt *stmt) payload_byte_size = div_round_up(payload->len + extra_len, BITS_PER_BYTE); + if (payload_byte_size > sizeof(data)) + return expr_error(ctx->msgs, stmt->payload.expr, + "uneven load cannot span more than %u bytes, got %u", + sizeof(data), payload_byte_size); + if (need_csum && payload_byte_size & 1) { payload_byte_size++; diff --git a/tests/shell/testcases/bogons/nft-f/payload_expr_unaligned_store b/tests/shell/testcases/bogons/nft-f/payload_expr_unaligned_store new file mode 100644 index 00000000..c1358df4 --- /dev/null +++ b/tests/shell/testcases/bogons/nft-f/payload_expr_unaligned_store @@ -0,0 +1 @@ +add rule f i @th,1,128 set 1 |