From 5259feeb7cda089523a2196248baa5395bce4b50 Mon Sep 17 00:00:00 2001 From: Arturo Borrero Gonzalez Date: Sat, 12 Apr 2014 10:40:08 +0200 Subject: 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 --- src/datatype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/datatype.c') diff --git a/src/datatype.c b/src/datatype.c index ac42faa8..331f235a 100644 --- a/src/datatype.c +++ b/src/datatype.c @@ -124,7 +124,7 @@ struct error_record *symbolic_constant_parse(const struct expr *sym, *res = constant_expr_alloc(&sym->location, dtype, dtype->byteorder, dtype->size, - &s->value); + constant_data_ptr(s->value, dtype->size)); return NULL; } -- cgit v1.2.3