From: Guy Harris Date: Sat, 18 Jan 2014 20:13:57 +0000 (-0800) Subject: More UNALIGNED_MEM{CPY,CMP} on IP addresses. X-Git-Tag: tcpdump-4.6.0~253 X-Git-Url: https://git.tcpdump.org/tcpdump/commitdiff_plain/47fc89d711eec0a073d9b3b293a1af901b5bd791 More UNALIGNED_MEM{CPY,CMP} on IP addresses. --- 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; }