Skip to contentSkip to conversation

payload: fix endianess issue in payload_expr_pctx_update()

PATCH Superseded Pablo Neira Ayuso 1 participant 1 message Dec 4, 2014 netfilter

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 payload: fix endianess issue in payload_expr_pctx_update()

Use constant_data_ptr() to point to the right memory position on big endian when exporting data that is stored in a larger variable.

---
 src/payload.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
src/payload.c +2 -2
index ebf8079..83742fb 100644
@@ -79,8 +79,8 @@ static void payload_expr_pctx_update(struct proto_ctx *ctx,
 
 	/* Export the data in the correct byte order */
 	assert(right->len / BITS_PER_BYTE <= sizeof(proto));
-	mpz_export_data(&proto, right->value, right->byteorder,
-			right->len / BITS_PER_BYTE);
+	mpz_export_data(constant_data_ptr(proto, right->len), right->value,
+			right->byteorder, right->len / BITS_PER_BYTE);
 
 	base = ctx->protocol[left->payload.base].desc;
 	desc = proto_find_upper(base, proto);
Signature · 1 line
1.7.10.4