X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/3824a6c0417a551961d1a1bf4f94f10eff736afc..refs/heads/tcpdump-3.8:/print-ospf.c diff --git a/print-ospf.c b/print-ospf.c index fe20bcc9..79ed3970 100644 --- a/print-ospf.c +++ b/print-ospf.c @@ -21,6 +21,10 @@ * OSPF support contributed by Jeffrey Honig (jch@mitchell.cit.cornell.edu) */ +#ifndef lint +static const char rcsid[] _U_ = + "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.45.2.4 2004-03-24 02:44:30 guy Exp $ (LBL)"; +#endif #ifdef HAVE_CONFIG_H #include "config.h" @@ -35,10 +39,6 @@ #include "extract.h" #include "gmpls.h" -#ifndef lint -static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.46 2003-11-15 00:39:34 guy Exp $ (LBL)"; -#endif #include "ospf.h" #include "ip.h" @@ -413,12 +413,10 @@ ospf_print_lsa(register const struct lsa *lsap) switch (*(&lsap->ls_hdr.un_lsa_id.opaque_field.opaque_type)) { case LS_OPAQUE_TYPE_TE: - if (!TTEST2(*tptr, 4)) - goto trunc; - tptr = (u_int8_t *)(&lsap->lsa_un.un_te_lsa_tlv.type); while (ls_length != 0) { + TCHECK2(*tptr, 4); if (ls_length < 4) { printf("\n\t Remaining LS length %u < 4", ls_length); return(ls_end); @@ -447,8 +445,7 @@ ospf_print_lsa(register const struct lsa *lsap) tlv_length); return(ls_end); } - if (!TTEST2(*tptr, 4)) - goto trunc; + TCHECK2(*tptr, 4); subtlv_type = EXTRACT_16BITS(tptr); subtlv_length = EXTRACT_16BITS(tptr+2); tptr+=4; @@ -459,8 +456,7 @@ ospf_print_lsa(register const struct lsa *lsap) subtlv_type, subtlv_length); - if (!TTEST2(*tptr, subtlv_length)) - goto trunc; + TCHECK2(*tptr, subtlv_length); switch(subtlv_type) { case LS_OPAQUE_TE_LINK_SUBTLV_ADMIN_GROUP: printf(", 0x%08x", EXTRACT_32BITS(tptr)); @@ -550,6 +546,11 @@ ospf_print_lsa(register const struct lsa *lsap) break; case LS_OPAQUE_TE_TLV_ROUTER: + if (tlv_length < 4) { + printf("\n\t TLV length %u < 4", tlv_length); + return(ls_end); + } + TCHECK2(*tptr, 4); printf(", %s", ipaddr_string(tptr)); break;