]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-ospf.c
Add length checks.
[tcpdump] / print-ospf.c
index fe20bcc976f119fc562d1c986f1c2eb8d4bf361d..dddf2ab19452063e65f3c77548fb6630a0737e9d 100644 (file)
  * OSPF support contributed by Jeffrey Honig ([email protected])
  */
 
+#ifndef lint
+static const char rcsid[] _U_ =
+    "@(#) $Header: /tcpdump/master/tcpdump/print-ospf.c,v 1.45.2.3 2003-11-19 09:43:47 guy Exp $ (LBL)";
+#endif
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #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,11 @@ 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) {
+                    if (!TTEST2(*tptr, 4))
+                        goto trunc;
                    if (ls_length < 4) {
                         printf("\n\t    Remaining LS length %u < 4", ls_length);
                         return(ls_end);