]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Juniper: Report invalid packets as invalid, not truncated
authorFrancois-Xavier Le Bail <[email protected]>
Mon, 27 Dec 2021 14:40:13 +0000 (15:40 +0100)
committerFrancois-Xavier Le Bail <[email protected]>
Sun, 20 Mar 2022 19:34:25 +0000 (20:34 +0100)
Update the output of a test accordingly.

(cherry picked from commit 705fa25c5f02ed90dc30a5d93c0e72acb53d0941)

print-juniper.c
tests/juniper_header-heapoverflow.out

index 0fbead927c6cbac9adbadb65cf2f89eff5c29d39..fdd1295ca5c67203edf81691f92f54f26fe6d5da 100644 (file)
@@ -1331,8 +1331,7 @@ juniper_parse_header(netdissect_options *ndo,
             /* sanity checks */
             if (tlv_type == 0 || tlv_len == 0)
                 break;
-            if (tlv_len+JUNIPER_EXT_TLV_OVERHEAD > extension_length)
-                goto trunc;
+            ND_LCHECK_U(extension_length, tlv_len + JUNIPER_EXT_TLV_OVERHEAD);
 
             if (ndo->ndo_vflag > 1)
                 ND_PRINT("\n\t  %s Extension TLV #%u, length %u, value ",
@@ -1589,8 +1588,8 @@ juniper_parse_header(netdissect_options *ndo,
         ND_PRINT("hlen %u, proto 0x%04x, ", l2info->header_len, l2info->proto);
 
     return 1; /* everything went ok so far. continue parsing */
-trunc:
-    nd_print_trunc(ndo);
+invalid:
+    nd_print_invalid(ndo);
     return 0;
 }
 #endif /* defined(DLT_JUNIPER_GGSN) || defined(DLT_JUNIPER_ES) || \
index 732d5709e5b1f14fe3b0d8d71fe5bd5efe996474..f3e4641c3fce75b50c0be932ca5e330736f30e43 100644 (file)
@@ -1 +1 @@
-    1  01:10:59.680304  [|juniper_ether]
+    1  01:10:59.680304  [extension_length 48 < 50] (invalid)