From 0cb4bae27503d2fa6e9e2efd1944049338d7c3c4 Mon Sep 17 00:00:00 2001 From: Ludovico Cavedon Date: Tue, 15 Jan 2019 23:10:48 -0800 Subject: QUIC: convert little endian offsets to host endianness Offset in the QUIC protocol are little endian. Reading them as uint32_t works on little endian architectures, but breaks on big endian ones. This change applies the proper conversion and fixes running the http_ipv6 and quic tests on big endian architectures. --- src/lib/protocols/quic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib/protocols') diff --git a/src/lib/protocols/quic.c b/src/lib/protocols/quic.c index e28db634a..322eb9be7 100644 --- a/src/lib/protocols/quic.c +++ b/src/lib/protocols/quic.c @@ -96,8 +96,8 @@ void ndpi_search_quic(struct ndpi_detection_module_struct *ndpi_struct, && (packet->payload[i+1] == 'N') && (packet->payload[i+2] == 'I') && (packet->payload[i+3] == 0)) { - u_int32_t offset = *((u_int32_t*)&packet->payload[i+4]); - u_int32_t prev_offset = *((u_int32_t*)&packet->payload[i-4]); + u_int32_t offset = le32toh(*((u_int32_t*)&packet->payload[i+4])); + u_int32_t prev_offset = le32toh(*((u_int32_t*)&packet->payload[i-4])); int len = offset-prev_offset; int sni_offset = i+prev_offset+1; -- cgit v1.2.3