* [PATCH nft] payload: fix endianess issue in payload_expr_pctx_update()
@ 2014-12-04 13:25 Pablo Neira Ayuso
0 siblings, 0 replies; only message in thread
From: Pablo Neira Ayuso @ 2014-12-04 13:25 UTC (permalink / raw)
To: netfilter-devel; +Cc: kaber, christophe.leroy
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>
---
src/payload.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/payload.c b/src/payload.c
index ebf8079..83742fb 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);
--
1.7.10.4
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-04 13:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-04 13:25 [PATCH nft] payload: fix endianess issue in payload_expr_pctx_update() Pablo Neira Ayuso
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).