]> The Tcpdump Group git mirrors - tcpdump/commitdiff
More UNALIGNED_MEM{CPY,CMP} on IP addresses.
authorGuy Harris <[email protected]>
Sat, 18 Jan 2014 20:13:57 +0000 (12:13 -0800)
committerGuy Harris <[email protected]>
Sat, 18 Jan 2014 20:13:57 +0000 (12:13 -0800)
print-tcp.c

index 16aa8b60019a384dc6440e4893f9d9112d387abb..bb76ac7c506177b57a8ea59a30c60d9f2b3d3000 100644 (file)
@@ -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;
                         }