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) {
+ if (!checksum || 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);
calculated_checksum = create_osi_cksum(pptr, checksum_offset, length);
if (checksum == calculated_checksum) {
ND_PRINT((ndo, " (correct)"));
} else {
- ND_PRINT((ndo, " (incorrect should be 0x%04x)", calculated_checksum));
+ truncated = "incorrect";
+ //trunc:
+ ND_PRINT((ndo, " (%s should be 0x%04x)", truncated, calculated_checksum));
}
}
}
pdu_header = (rpki_rtr_pdu *)tptr;
pdu_type = pdu_header->pdu_type;
pdu_len = EXTRACT_32BITS(pdu_header->length);
+ ND_TCHECK2(tptr, pdu_len);
hexdump = FALSE;
ND_PRINT((ndo, "%sRPKI-RTRv%u, %s PDU (%u), length: %u",
tptr += 4;
tlen -= 4;
}
+ printf("text_length: %u tlen %u\n", text_length, tlen);
if (text_length && (text_length <= tlen )) {
memcpy(buf, tptr, min(sizeof(buf)-1, text_length));
buf[text_length] = '\0';
if (ndo->ndo_vflag > 1 || (ndo->ndo_vflag && hexdump)) {
print_unknown_data(ndo,tptr,"\n\t ", pdu_len);
}
+ return;
+
+ trunc:
+ ND_PRINT((ndo, "|trunc"));
+ return;
}
void