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),
{
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));
}
}