]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Fetch a 32-bit big-endian quantity with EXTRACT_32BITS().
authorGuy Harris <[email protected]>
Mon, 27 Apr 2015 00:03:32 +0000 (17:03 -0700)
committerGuy Harris <[email protected]>
Mon, 4 May 2015 01:01:38 +0000 (18:01 -0700)
*Don't* fetch it with a pointer cast and dereference!  That will fail on
little-endian machines and may fail on machines that don't handle
unaligned references.

print-icmp6.c

index 81563e6c81389308823b0de6a916cf973ca5ea8e..0af02a1207217f4847819e2648d429a33a84a39a 100644 (file)
@@ -1784,7 +1784,7 @@ icmp6_nodeinfo_print(netdissect_options *ndo, u_int icmp6len, const u_char *bp,
                        } else
                                dnsname_print(ndo, cp, ep);
                        if ((EXTRACT_16BITS(&ni6->ni_flags) & 0x01) != 0)
-                               ND_PRINT((ndo," [TTL=%u]", *(uint32_t *)(ni6 + 1)));
+                               ND_PRINT((ndo," [TTL=%u]", EXTRACT_32BITS(ni6 + 1)));
                        break;
                case NI_QTYPE_NODEADDR:
                        if (needcomma)