Skip to contentSkip to conversation

src: json: fix constant parsing on bigendian

PATCH In review Florian Westphal 2 participants 2 messages Aug 14, 2019 netfilter

lore
Share & tools
lore

Florian Westphal

author maintainer
#0 lore raw

PATCH 1/1 src: json: fix constant parsing on bigendian

json restore is broken on big-endian because we errounously passed uint8_t with 64 bit size indicator.

On bigendian, this causes all values to get shifted by 56 bit, this will then cause the eval step to bail because all values are outside of the 8bit 0-255 protocol range.

---
 src/parser_json.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/parser_json.c +1 -1
index d42bab704f7c..a969bd4c3676 100644
@@ -304,7 +304,7 @@ static struct expr *json_parse_constant(struct json_ctx *ctx, const char *name)
 		return constant_expr_alloc(int_loc,
 					   constant_tbl[i].dtype,
 					   BYTEORDER_HOST_ENDIAN,
-					   8 * BITS_PER_BYTE,
+					   BITS_PER_BYTE,
 					   &constant_tbl[i].data);
 	}
 	json_error(ctx, "Unknown constant '%s'.", name);
Signature · 1 line
2.21.0