summaryrefslogtreecommitdiff
path: root/print-smb.c
diff options
context:
space:
mode:
authorGuy Harris <gharris@sonic.net>2020-05-25 02:02:34 -0700
committerGuy Harris <gharris@sonic.net>2020-05-25 02:02:34 -0700
commit2ba1be35231dbdad50729e544fe4c2252aa15008 (patch)
tree5d1aa4aa5c51c1be8aed14fdfa037c2ea8741574 /print-smb.c
parent5a1d8b7774d1b9359cd0681a29eec3df5c48231c (diff)
downloadtcpdump-2ba1be35231dbdad50729e544fe4c2252aa15008.tar.gz
Squelch some warnings.
Use ND_BYTES_AVAILABLE_AFTER() to calculate the number of bytes remaining in the packet after a given pointer, rather than doing the subtraction directly; that casts the result to a u_int (we don't handle packets bigger than the maximum u_int value, so the difference between the pointers will never be bigger than that value), so we don't have to deal with it being a 64-bit value on LP64 or LLP64 systems. (It also makes it a bit clearer what we're doing). Clean up some indentation while we're at it.
Diffstat (limited to 'print-smb.c')
-rw-r--r--print-smb.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/print-smb.c b/print-smb.c
index 402bb71f..38a6a433 100644
--- a/print-smb.c
+++ b/print-smb.c
@@ -952,7 +952,7 @@ nbt_tcp_print(netdissect_options *ndo,
goto trunc;
if (ndo->ndo_snapend < data)
goto trunc;
- caplen = ndo->ndo_snapend - data;
+ caplen = ND_BYTES_AVAILABLE_AFTER(data);
if (caplen < 4)
goto trunc;
maxbuf = data + caplen;
@@ -1269,7 +1269,7 @@ smb_tcp_print(netdissect_options *ndo,
goto trunc;
if (ndo->ndo_snapend < data)
goto trunc;
- caplen = ndo->ndo_snapend - data;
+ caplen = ND_BYTES_AVAILABLE_AFTER(data);
if (caplen < 4)
goto trunc;
maxbuf = data + caplen;