diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:52:31 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-19 04:52:31 +0000 |
commit | 31cd589d20ba8d3d6b3fc4fccacc40d38a163c5d (patch) | |
tree | 99d6c086833d530e5d1d33a8128961f8149843f0 /print-icmp6.c | |
parent | Adding upstream version 4.99.4. (diff) | |
download | tcpdump-31cd589d20ba8d3d6b3fc4fccacc40d38a163c5d.tar.xz tcpdump-31cd589d20ba8d3d6b3fc4fccacc40d38a163c5d.zip |
Adding upstream version 4.99.5.upstream/4.99.5upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'print-icmp6.c')
-rw-r--r-- | print-icmp6.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/print-icmp6.c b/print-icmp6.c index 4738e77..e67b19b 100644 --- a/print-icmp6.c +++ b/print-icmp6.c @@ -21,9 +21,7 @@ /* \summary: IPv6 Internet Control Message Protocol (ICMPv6) printer */ -#ifdef HAVE_CONFIG_H #include <config.h> -#endif #include "netdissect-stdinc.h" @@ -526,7 +524,7 @@ struct nd_rpl_security { #endif }; -/* section 6.2.1, DODAG Information Solication (DIS_IS) */ +/* section 6.2.1, DODAG Information Solicitation (DIS_IS) */ struct nd_rpl_dis_is { nd_uint8_t rpl_dis_flags; nd_uint8_t rpl_dis_reserved; @@ -841,7 +839,7 @@ rpl_dio_print(netdissect_options *ndo, { const struct nd_rpl_dio *dio = (const struct nd_rpl_dio *)bp; - ND_LCHECK_ZU(length, sizeof(struct nd_rpl_dio)); + ND_ICHECK_ZU(length, <, sizeof(struct nd_rpl_dio)); ND_PRINT(" [dagid:%s,seq:%u,instance:%u,rank:%u,%smop:%s,prf:%u]", GET_IP6ADDR_STRING(dio->rpl_dagid), GET_U_1(dio->rpl_dtsn), @@ -1271,7 +1269,8 @@ icmp6_print(netdissect_options *ndo, ND_PRINT(", id 0x%04x", GET_BE_U_2(dp->icmp6_data16[0])); - cp = (const u_char *)dp + length; + cp = (const u_char *)dp + + ND_MIN(length, ND_BYTES_AVAILABLE_AFTER(dp)); p = (const u_char *)(dp + 1); while (p < cp) { ND_PRINT(", %s", GET_IP6ADDR_STRING(p)); @@ -1346,8 +1345,7 @@ get_upperlayer(netdissect_options *ndo, const u_char *bp, u_int *prot) if (ND_TTEST_2(uh->uh_dport)) { *prot = nh; return(uh); - } - else + } else return(NULL); /* NOTREACHED */ @@ -1475,8 +1473,7 @@ icmp6_opt_print(netdissect_options *ndo, const u_char *bp, int resid) ND_PRINT(" lifetime %us, domain(s):", GET_BE_U_4(opds->nd_opt_dnssl_lifetime)); domp = cp + 8; /* domain names, variable-sized, RFC1035-encoded */ - while (domp < cp + (opt_len << 3) && GET_U_1(domp) != '\0') - { + while (domp < cp + (opt_len << 3) && GET_U_1(domp) != '\0') { ND_PRINT(" "); if ((domp = fqdn_print(ndo, domp, bp)) == NULL) goto trunc; |