summaryrefslogtreecommitdiff
path: root/print-ppp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-04-18 10:13:49 -0700
committerGuy Harris <guy@alum.mit.edu>2019-04-18 10:13:49 -0700
commit07a7f33ba3ff346b9ce31772645a06980baca907 (patch)
tree111a5a89cefb1c27e83b1aa4fb7a95e7c6163b8d /print-ppp.c
parent7c30120f52c22c1dd971431383ad2df8ca1a12c4 (diff)
downloadtcpdump-07a7f33ba3ff346b9ce31772645a06980baca907.tar.gz
Fix some narrowing warnings on LP64/LLP64 platforms.
Add a ND_BYTES_AVAILABLE_AFTER() macro to find the number of bytes available in the captured data, starting at the byte pointed to by the argument. It returns a u_int rather than a ptrdiff_t, so it'll be 32 bits on LP64 and LLP64 platforms as well as on ILP32 platforms. Use that macro. Make size-of-buffer arguments size_t. Cast some size_t and ptrdiff_t values to u_int or int.
Diffstat (limited to 'print-ppp.c')
-rw-r--r--print-ppp.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/print-ppp.c b/print-ppp.c
index 1f82e7da..a1b3214f 100644
--- a/print-ppp.c
+++ b/print-ppp.c
@@ -906,7 +906,7 @@ handle_chap(netdissect_options *ndo,
ND_PRINT("%02x", GET_U_1(p));
p++;
}
- name_size = len - (p - p0);
+ name_size = len - (u_int)(p - p0);
ND_PRINT(", Name ");
for (i = 0; i < name_size; i++) {
ND_TCHECK_1(p);
@@ -916,7 +916,7 @@ handle_chap(netdissect_options *ndo,
break;
case CHAP_SUCC:
case CHAP_FAIL:
- msg_size = len - (p - p0);
+ msg_size = len - (u_int)(p - p0);
ND_PRINT(", Msg ");
for (i = 0; i< msg_size; i++) {
ND_TCHECK_1(p);
@@ -1443,7 +1443,7 @@ ppp_hdlc(netdissect_options *ndo,
*/
se = ndo->ndo_snapend;
ndo->ndo_snapend = t;
- length = t - b;
+ length = ND_BYTES_AVAILABLE_AFTER(b);
/* now lets guess about the payload codepoint format */
if (length < 1)