]> 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, 27 Apr 2015 00:03:32 +0000 (17:03 -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 f6907a4c24abbc9d78e959fc6980c186a70bc07e..279ca575c8b47b02112fd99860092aec2656714c 100644 (file)
@@ -1783,7 +1783,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)