]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Babel: parse sub-TLVs even when they are larger than expected. 396/head
authorBaptiste Jonglez <[email protected]>
Fri, 20 Jun 2014 00:46:00 +0000 (09:46 +0900)
committerBaptiste Jonglez <[email protected]>
Fri, 20 Jun 2014 00:46:00 +0000 (09:46 +0900)
We can imagine appending additional data to sub-TLVs in the future: be
more forgiving when parsing them.

print-babel.c

index 51de311498460db6ef4ece5c2032ab45b8067035..bb3401be5e07aefa43d095179d17986fe2361a21 100644 (file)
@@ -309,12 +309,12 @@ subtlvs_print(netdissect_options *ndo,
         case MESSAGE_SUB_TIMESTAMP:
             ND_PRINT((ndo, " sub-timestamp"));
             if(tlv_type == MESSAGE_HELLO) {
-                if(sublen != 4)
+                if(sublen < 4)
                     goto corrupt;
                 t1 = EXTRACT_32BITS(cp);
                 ND_PRINT((ndo, " %s", format_timestamp(t1)));
             } else if(tlv_type == MESSAGE_IHU) {
-                if(sublen != 8)
+                if(sublen < 8)
                     goto corrupt;
                 t1 = EXTRACT_32BITS(cp);
                 ND_PRINT((ndo, " %s", format_timestamp(t1)));