]> The Tcpdump Group git mirrors - tcpdump/commitdiff
clnp: use ND_BYTES_BETWEEN() to get the bytes between two packet pointers.
authorGuy Harris <[email protected]>
Wed, 27 May 2020 05:09:11 +0000 (22:09 -0700)
committerGuy Harris <[email protected]>
Wed, 27 May 2020 05:09:11 +0000 (22:09 -0700)
That'll cast it to a u_int, so it's 1) unsigned and 2) not 64-bit on
LP64 or LLP64 platforms.

print-isoclns.c

index b356871475ddc9f08823228dea97ba41ff3ca0f7..882da50a874e28064c13f09e1bde642def561a60 100644 (file)
@@ -1135,9 +1135,9 @@ clnp_print(netdissect_options *ndo,
 
         default:
             /* dump the PDU specific data */
-            if (length-(pptr-optr) > 0) {
+            if (length > ND_BYTES_BETWEEN(pptr, optr)) {
                 ND_PRINT("\n\t  undecoded non-header data, length %u", length-li);
-                print_unknown_data(ndo, pptr, "\n\t  ", length - (int)(pptr - optr));
+                print_unknown_data(ndo, pptr, "\n\t  ", length - ND_BYTES_BETWEEN(pptr, optr));
             }
         }