From 2ba1be35231dbdad50729e544fe4c2252aa15008 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Mon, 25 May 2020 02:02:34 -0700 Subject: 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. --- print-smb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'print-smb.c') 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; -- cgit v1.2.1