summaryrefslogtreecommitdiffstats
path: root/src/payload.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2014-12-04 14:18:59 +0100
committerPablo Neira Ayuso <pablo@netfilter.org>2014-12-05 11:38:42 +0100
commit82e0a693110be85b6ebc023b4dbf5e798ac60bdc (patch)
treecc7bc94cc7cd60bb85cd5bfe755a8ace5296dc09 /src/payload.c
parent77272b500f294ab726e265ec972a35d8a542fe69 (diff)
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. Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Tested-by: Christophe Leroy <christophe.leroy@c-s.fr>
Diffstat (limited to 'src/payload.c')
-rw-r--r--src/payload.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/payload.c b/src/payload.c
index ebf8079b..83742fb0 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -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);