diff options
author | Guy Harris <gharris@sonic.net> | 2023-04-11 04:21:10 -0700 |
---|---|---|
committer | Guy Harris <gharris@sonic.net> | 2023-04-11 04:21:10 -0700 |
commit | 1f3cdf9e55a5dd86c3cbb54e20d232b7aca59457 (patch) | |
tree | e1bf1a9873d86f98c2934f3a99e760c0d6b05d1b | |
parent | 6c8a3facc7f5eb6a03c5a606ebf2c0fcfd0e70cc (diff) | |
download | tcpdump-1f3cdf9e55a5dd86c3cbb54e20d232b7aca59457.tar.gz |
nhrp: add casts to squelch narrowing warnings.
Get rid of some commented-out code while we're at it.
-rw-r--r-- | print-nhrp.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/print-nhrp.c b/print-nhrp.c index 2ef08ba7..1e63f01b 100644 --- a/print-nhrp.c +++ b/print-nhrp.c @@ -212,7 +212,7 @@ nhrp_print(netdissect_options *ndo, const u_char *bp, u_int length) } length -= sizeof(*fixed_hdr); if (mand_part_len > length) - mand_part_len = length; + mand_part_len = (uint16_t)length; /* We start looking at the mandatory header here. */ ND_TCHECK_LEN(bp, sizeof(*fixed_hdr)); @@ -222,9 +222,6 @@ nhrp_print(netdissect_options *ndo, const u_char *bp, u_int length) ND_TCHECK_LEN(bp, sizeof(*mand_hdr)); mand_hdr = (const struct nhrp_mand_header *)bp; -// nhrpext = p + extoff; -// nhrpend = p + pktsz; - switch (op_type) { case NHRP_PKT_RESOLUTION_REQUEST: case NHRP_PKT_RESOLUTION_REPLY: @@ -339,10 +336,14 @@ nhrp_print(netdissect_options *ndo, const u_char *bp, u_int length) while (mand_part_len != 0) { u_int cie_len; + /* + * cie_len is guaranteed by nhrp_print_cie() + * to be <= mand_part_len. + */ cie_len = nhrp_print_cie(ndo, bp, mand_part_len, afn, pro_type); bp += cie_len; - mand_part_len -= cie_len; + mand_part_len -= (uint16_t)cie_len; } break; case NHRP_PKT_ERROR_INDICATION: |