X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/49b23c5a9b0198bb382dcf43c458d46fcf2fa809..1fb50928ce27360c1c987312774f686b23c69b51:/print-ip6.c diff --git a/print-ip6.c b/print-ip6.c index c5811300..9f590f2a 100644 --- a/print-ip6.c +++ b/print-ip6.c @@ -293,15 +293,19 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) switch (nh) { case IPPROTO_HOPOPTS: advance = hbhopt_print(ndo, cp); + if (advance < 0) + return; nh = *cp; break; case IPPROTO_DSTOPTS: advance = dstopt_print(ndo, cp); + if (advance < 0) + return; nh = *cp; break; case IPPROTO_FRAGMENT: advance = frag6_print(ndo, cp, (const u_char *)ip6); - if (ndo->ndo_snapend <= cp + advance) + if (advance < 0 || ndo->ndo_snapend <= cp + advance) return; nh = *cp; fragmented = 1; @@ -353,9 +357,14 @@ ip6_print(netdissect_options *ndo, const u_char *bp, u_int length) } case IPPROTO_IPCOMP: { - int enh; - advance = ipcomp_print(ndo, cp, &enh); - nh = enh & 0xff; + ipcomp_print(ndo, cp); + /* + * Either this has decompressed the payload and + * printed it, in which case there's nothing more + * to do, or it hasn't, in which case there's + * nothing more to do. + */ + advance = -1; break; }