]> The Tcpdump Group git mirrors - tcpdump/commitdiff
bugfix: prevent infinite loop in ERO processing, print ERO subtype length
authorhannes <hannes>
Tue, 26 Apr 2005 14:00:03 +0000 (14:00 +0000)
committerhannes <hannes>
Tue, 26 Apr 2005 14:00:03 +0000 (14:00 +0000)
print-rsvp.c

index 388c3b5d5590bc636846baa44683fa84de28be7d..1f04224c40d6dd7366687dfc627821d526ab8192 100644 (file)
@@ -15,7 +15,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.24.2.4 2005-01-13 07:28:23 hannes Exp $";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-rsvp.c,v 1.24.2.5 2005-04-26 14:00:03 hannes Exp $";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -875,10 +875,17 @@ rsvp_print(register const u_char *pptr, register u_int len) {
             switch(rsvp_obj_ctype) {
             case RSVP_CTYPE_IPV4:
                 while(obj_tlen >= 4 ) {
-                    printf("\n\t    Subobject Type: %s",
+                    printf("\n\t    Subobject Type: %s, length %u",
                            tok2str(rsvp_obj_xro_values,
                                    "Unknown %u",
-                                   RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)));                
+                                   RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)),
+                           *(obj_tptr+1));                
+
+                    if (*(obj_tptr+1) == 0) { /* prevent infinite loops */
+                        printf("\n\t      ERROR: zero length ERO subtype");
+                        break;
+                    }
+
                     switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)) {
                     case RSVP_OBJ_XRO_IPV4:
                         printf(", %s, %s/%u, Flags: [%s]",