]> The Tcpdump Group git mirrors - tcpdump/blobdiff - print-isoclns.c
Don't do IPv6 stuff if INET6 isn't defined.
[tcpdump] / print-isoclns.c
index dc1613ee021dca2e037ef00eb148ea46d113621d..f8de7bce613599814a6d9257e14ee17d9e8d833c 100644 (file)
@@ -2309,10 +2309,6 @@ isis_print(netdissect_options *ndo,
             length=pdu_len;
        }
 
-        if(length > ndo->ndo_snaplen) {
-                goto trunc;
-        }
-
        ND_TCHECK(*header_lsp);
        ND_PRINT((ndo, "\n\t  lsp-id: %s, seq: 0x%08x, lifetime: %5us\n\t  chksum: 0x%04x",
                isis_print_id(header_lsp->lsp_id, LSP_ID_LEN),
@@ -3085,19 +3081,30 @@ osi_print_cksum(netdissect_options *ndo,
 {
         uint16_t calculated_checksum;
 
-        /* do not attempt to verify the checksum if it is zero */
-        if (!checksum || checksum_offset > length) {
+        /* do not attempt to verify the checksum if it is zero,
+         * if the total length is nonsense,
+         * if the offset is nonsense,
+         * or the base pointer is not sane
+         */
+        if (!checksum
+            || length > ndo->ndo_snaplen
+            || checksum_offset > ndo->ndo_snaplen
+            || checksum_offset > length) {
                 ND_PRINT((ndo, "(unverified)"));
         } else {
                 unsigned char *truncated = "trunc";
-                //printf("\nosi_print_cksum: %p %u %u %u\n", pptr, checksum_offset, length, ndo->ndo_snaplen);
-                //ND_TCHECK2(pptr, checksum_offset+length);
+#if 0
+                printf("\nosi_print_cksum: %p %u %u %u\n", pptr, checksum_offset, length, ndo->ndo_snaplen);
+                ND_TCHECK2(pptr, checksum_offset+length);
+#endif
                 calculated_checksum = create_osi_cksum(pptr, checksum_offset, length);
                 if (checksum == calculated_checksum) {
                         ND_PRINT((ndo, " (correct)"));
                 } else {
                         truncated = "incorrect";
-                        //trunc:
+#if 0
+                        trunc:
+#endif
                         ND_PRINT((ndo, " (%s should be 0x%04x)", truncated, calculated_checksum));
                 }
         }