path: root/src/payload.c
diff options
authorArturo Borrero Gonzalez <>2014-04-12 10:40:08 +0200
committerPatrick McHardy <>2014-04-12 10:40:08 +0200
commit5259feeb7cda089523a2196248baa5395bce4b50 (patch)
tree852618a136d08c5ea37f1183aee5861d37af221e /src/payload.c
parent062cea3bbeabd616acc8c44eab6fd1165320cfd1 (diff)
expression: fix constant expression allocation on big endian
When allocating a constant expression, a pointer to the data is passed to the allocation function. When the variable used to store the data is larger than the size of the data type, this fails on big endian since the most significant bytes (being zero) come first. Add a helper function to calculate the proper address for the cases where this is needed. This currently affects symbolic tables for values < u64 and payload dependency generation for protocol values < u32. Signed-off-by: Patrick McHardy <>
Diffstat (limited to 'src/payload.c')
1 files changed, 2 insertions, 1 deletions
diff --git a/src/payload.c b/src/payload.c
index 427080c0..a1785a59 100644
--- a/src/payload.c
+++ b/src/payload.c
@@ -209,7 +209,8 @@ int payload_gen_dependency(struct eval_ctx *ctx, const struct expr *expr,
right = constant_expr_alloc(&expr->location, tmpl->dtype,
- tmpl->len, &protocol);
+ tmpl->len,
+ constant_data_ptr(protocol, tmpl->len));
dep = relational_expr_alloc(&expr->location, OP_EQ, left, right);
left->ops->pctx_update(&ctx->pctx, dep);