]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Shorten sizeof to u_int, to match the %u format used with it.
authorGuy Harris <[email protected]>
Mon, 21 Apr 2014 21:02:29 +0000 (14:02 -0700)
committerGuy Harris <[email protected]>
Mon, 21 Apr 2014 21:02:29 +0000 (14:02 -0700)
On LP64 and LLP64 platforms, sizeof returns a 64-bit value, which is
larger than an int or unsigned int, so if you add the result of sizeof
to a value shorter than 64 bits, you can't print the result with %u.

As an M3UA parameter header is much shorter than 2^32 bytes, we can
safely just cast sizeof(struct m3ua_param_header) to u_int.

print-m3ua.c

index 4e5d1413c396718d9484ed03cefe3a13381a6104..f3dbfbf51c28916c229a6fff0ce8fa20f37a461e 100644 (file)
@@ -224,7 +224,7 @@ tag_value_print(netdissect_options *ndo,
     break;
   /* ... */
   default:
-    ND_PRINT((ndo, "(length %u)", size + sizeof(struct m3ua_param_header)));
+    ND_PRINT((ndo, "(length %u)", size + (u_int)sizeof(struct m3ua_param_header)));
     ND_TCHECK2(*buf, size);
   }
   return;