X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/0f9428904ade10d6cf116e00b4bcc63e233b0a79..19e63b148b385f238d94e9b159de06c89cfee02e:/print-ldp.c diff --git a/print-ldp.c b/print-ldp.c index 680a7e1e..49379f0d 100644 --- a/print-ldp.c +++ b/print-ldp.c @@ -211,7 +211,7 @@ static const struct tok ldp_fec_martini_ifparm_vccv_cv_values[] = { { 0, NULL} }; -static int ldp_pdu_print(netdissect_options *, const u_char *); +static u_int ldp_pdu_print(netdissect_options *, const u_char *); /* * ldp tlv header @@ -547,19 +547,24 @@ void ldp_print(netdissect_options *ndo, const u_char *pptr, u_int len) { - int processed; + u_int processed; ndo->ndo_protocol = "ldp"; while (len > (sizeof(struct ldp_common_header) + sizeof(struct ldp_msg_header))) { processed = ldp_pdu_print(ndo, pptr); if (processed == 0) return; + if (len < processed) { + ND_PRINT(" [remaining length %u < %u]", len, processed); + nd_print_invalid(ndo); + break; + } len -= processed; pptr += processed; } } -static int +static u_int ldp_pdu_print(netdissect_options *ndo, const u_char *pptr) {