From: Phil Sutter Date: Thu, 17 Dec 2020 17:19:18 +0000 (+0100) Subject: src: Fix payload statement mask on Big Endian X-Git-Tag: v1.0.2~86 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=15c39ac1f6924e51f0715de4266a5f1a3b9f31fc;p=thirdparty%2Fnftables.git src: Fix payload statement mask on Big Endian The mask used to select bits to keep must be exported in the same byteorder as the payload statement itself, also the length of the exported data must match the number of bytes extracted earlier. Signed-off-by: Phil Sutter --- diff --git a/src/evaluate.c b/src/evaluate.c index eebd9921..49fb8f84 100644 --- a/src/evaluate.c +++ b/src/evaluate.c @@ -2556,9 +2556,9 @@ static int stmt_evaluate_payload(struct eval_ctx *ctx, struct stmt *stmt) mpz_clear(ff); assert(sizeof(data) * BITS_PER_BYTE >= masklen); - mpz_export_data(data, bitmask, BYTEORDER_HOST_ENDIAN, sizeof(data)); + mpz_export_data(data, bitmask, payload->byteorder, payload_byte_size); mask = constant_expr_alloc(&payload->location, expr_basetype(payload), - BYTEORDER_HOST_ENDIAN, masklen, data); + payload->byteorder, masklen, data); mpz_clear(bitmask); payload_bytes = payload_expr_alloc(&payload->location, NULL, 0);