]> The Tcpdump Group git mirrors - tcpdump/commitdiff
smb: use ND_BYTES_BETWEEN() to get the bytes between two packet pointers.
authorGuy Harris <[email protected]>
Wed, 27 May 2020 21:19:17 +0000 (14:19 -0700)
committerGuy Harris <[email protected]>
Wed, 27 May 2020 21:19:17 +0000 (14:19 -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-smb.c

index 38a6a433ce08200ee1c68ce2ff57e786d7daf637..77d9f8144bc0739bd3fc6ca2c11a6fd5382e2e26 100644 (file)
@@ -1237,7 +1237,7 @@ nbt_udp137_print(netdissect_options *ndo,
                } else {
                    if (p >= maxbuf)
                        goto out;
-                   smb_data_print(ndo, p, min(rdlen, length - (p - data)));
+                   smb_data_print(ndo, p, min(rdlen, length - ND_BYTES_BETWEEN(p, data)));
                    p += rdlen;
                }
            }