From 47fc89d711eec0a073d9b3b293a1af901b5bd791 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Sat, 18 Jan 2014 12:13:57 -0800 Subject: [PATCH] More UNALIGNED_MEM{CPY,CMP} on IP addresses. --- print-tcp.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/print-tcp.c b/print-tcp.c index 16aa8b60..bb76ac7c 100644 --- a/print-tcp.c +++ b/print-tcp.c @@ -258,16 +258,16 @@ tcp_print(register const u_char *bp, register u_int length, if (sport > dport) rev = 1; else if (sport == dport) { - if (memcmp(src, dst, sizeof ip6->ip6_dst) > 0) + if (UNALIGNED_MEMCMP(src, dst, sizeof ip6->ip6_dst) > 0) rev = 1; } if (rev) { - memcpy(&tha.src, dst, sizeof ip6->ip6_dst); - memcpy(&tha.dst, src, sizeof ip6->ip6_src); + UNALIGNED_MEMCPY(&tha.src, dst, sizeof ip6->ip6_dst); + UNALIGNED_MEMCPY(&tha.dst, src, sizeof ip6->ip6_src); tha.port = dport << 16 | sport; } else { - memcpy(&tha.dst, dst, sizeof ip6->ip6_dst); - memcpy(&tha.src, src, sizeof ip6->ip6_src); + UNALIGNED_MEMCPY(&tha.dst, dst, sizeof ip6->ip6_dst); + UNALIGNED_MEMCPY(&tha.src, src, sizeof ip6->ip6_src); tha.port = sport << 16 | dport; } -- 2.39.5