]> The Tcpdump Group git mirrors - tcpdump/commitdiff
IPX: Use more the nd_uint32_t type
authorFrancois-Xavier Le Bail <[email protected]>
Tue, 30 Jan 2018 18:03:49 +0000 (19:03 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Tue, 30 Jan 2018 19:13:15 +0000 (20:13 +0100)
In 'struct ipxHdr'.
This avoid some 'undefined-behavior' warnings with clang and option
-fsanitize=undefined enabled.

print-ipx.c:79:2: runtime error: member access within misaligned address
0x61d00001ea91 for type 'const struct ipxHdr', which requires 2 byte alignment
0x61d00001ea91: note: pointer points here
 54 e0 e0  03 ff ff 00 50 00 14 00  00 00 00 ff ff ff ff ff  ff 04 55 a8 f8 79 67 00  00 00 00 00 01
              ^
SUMMARY: AddressSanitizer: undefined-behavior print-ipx.c:79:2 in

print-ipx.c

index 4faebf733538ae0ca8cd7051f031b96360b358ab..6dfa0a9e12f08db667808ef6fcae4146269d0a3b 100644 (file)
@@ -50,10 +50,10 @@ struct ipxHdr {
     nd_uint16_t        length;         /* Length, in bytes, including header */
     nd_uint8_t tCtl;           /* Transport Control (i.e. hop count) */
     nd_uint8_t pType;          /* Packet Type (i.e. level 2 protocol) */
-    uint16_t   dstNet[2];      /* destination net */
+    nd_uint32_t        dstNet;         /* destination net */
     nd_byte    dstNode[6];     /* destination node */
     nd_uint16_t        dstSkt;         /* destination socket */
-    uint16_t   srcNet[2];      /* source net */
+    nd_uint32_t        srcNet;         /* source net */
     nd_byte    srcNode[6];     /* source node */
     nd_uint16_t        srcSkt;         /* source socket */
 };