summaryrefslogtreecommitdiff
path: root/src/resolve/test-dns-packet.c
diff options
context:
space:
mode:
authorJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>2016-05-26 23:32:25 +0200
committerJohn Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>2016-05-26 23:32:25 +0200
commitaa91232040fdd25c8405cce4dea7c0f142d96236 (patch)
tree6e87dd90a38a415f410663d79f0cf0b72d72b437 /src/resolve/test-dns-packet.c
parentacc0269cad31d1aaef2034a055b34c07c88a353d (diff)
resolve/test-dns-packet: Fix unaligned access in test_packet_from_file().
Diffstat (limited to 'src/resolve/test-dns-packet.c')
-rw-r--r--src/resolve/test-dns-packet.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/resolve/test-dns-packet.c b/src/resolve/test-dns-packet.c
index c232a69ce1..41e5c1caa5 100644
--- a/src/resolve/test-dns-packet.c
+++ b/src/resolve/test-dns-packet.c
@@ -29,6 +29,7 @@
#include "resolved-dns-rr.h"
#include "string-util.h"
#include "strv.h"
+#include "unaligned.h"
#define HASH_KEY SD_ID128_MAKE(d3,1e,48,90,4b,fa,4c,fe,af,9d,d5,a1,d7,2e,8a,b1)
@@ -56,7 +57,7 @@ static void test_packet_from_file(const char* filename, bool canonical) {
const char *s, *s2;
uint64_t hash1, hash2;
- packet_size = le64toh( *(uint64_t*)(data + offset) );
+ packet_size = unaligned_read_le64(data + offset);
assert_se(packet_size > 0);
assert_se(offset + 8 + packet_size <= data_size);