X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/99250aed4e2c33bcaafc1f5217e18aca7eebdeb9..cfa9ab5f80dd9a1024e1a765bc0d24c57652b6bc:/print-rsvp.c diff --git a/print-rsvp.c b/print-rsvp.c index e7754d32..86744e06 100644 --- a/print-rsvp.c +++ b/print-rsvp.c @@ -25,6 +25,7 @@ #include "netdissect-stdinc.h" +#define ND_LONGJMP_FROM_TCHECK #include "netdissect.h" #include "extract.h" #include "addrtoname.h" @@ -518,11 +519,8 @@ rsvp_intserv_print(netdissect_options *ndo, uint32_t i; } bw; - if (obj_tlen < 4) - return 0; - ND_TCHECK_1(tptr); + ND_LCHECK_U(obj_tlen, 4); parameter_id = GET_U_1(tptr); - ND_TCHECK_2(tptr + 2); parameter_length = GET_BE_U_2(tptr + 2)<<2; /* convert wordcount to bytecount */ ND_PRINT("\n\t Parameter ID: %s (%u), length: %u, Flags: [0x%02x]", @@ -531,8 +529,7 @@ rsvp_intserv_print(netdissect_options *ndo, parameter_length, GET_U_1(tptr + 1)); - if (obj_tlen < parameter_length+4) - return 0; + ND_LCHECK_U(obj_tlen, parameter_length + 4); switch(parameter_id) { /* parameter_id */ case 4: @@ -544,7 +541,6 @@ rsvp_intserv_print(netdissect_options *ndo, * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ if (parameter_length == 4) { - ND_TCHECK_4(tptr + 4); ND_PRINT("\n\t\tIS hop count: %u", GET_BE_U_4(tptr + 4)); } break; @@ -558,7 +554,6 @@ rsvp_intserv_print(netdissect_options *ndo, * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ if (parameter_length == 4) { - ND_TCHECK_4(tptr + 4); bw.i = GET_BE_U_4(tptr + 4); ND_PRINT("\n\t\tPath b/w estimate: %.10g Mbps", bw.f / 125000); } @@ -573,7 +568,6 @@ rsvp_intserv_print(netdissect_options *ndo, * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ if (parameter_length == 4) { - ND_TCHECK_4(tptr + 4); ND_PRINT("\n\t\tMinimum path latency: "); if (GET_BE_U_4(tptr + 4) == 0xffffffff) ND_PRINT("don't care"); @@ -592,7 +586,6 @@ rsvp_intserv_print(netdissect_options *ndo, * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ */ if (parameter_length == 4) { - ND_TCHECK_4(tptr + 4); ND_PRINT("\n\t\tComposed MTU: %u bytes", GET_BE_U_4(tptr + 4)); } break; @@ -614,7 +607,6 @@ rsvp_intserv_print(netdissect_options *ndo, */ if (parameter_length == 20) { - ND_TCHECK_LEN(tptr + 4, 20); bw.i = GET_BE_U_4(tptr + 4); ND_PRINT("\n\t\tToken Bucket Rate: %.10g Mbps", bw.f / 125000); bw.i = GET_BE_U_4(tptr + 8); @@ -640,7 +632,6 @@ rsvp_intserv_print(netdissect_options *ndo, */ if (parameter_length == 8) { - ND_TCHECK_8(tptr + 4); bw.i = GET_BE_U_4(tptr + 4); ND_PRINT("\n\t\tRate: %.10g Mbps", bw.f / 125000); ND_PRINT("\n\t\tSlack Term: %u", GET_BE_U_4(tptr + 8)); @@ -652,7 +643,6 @@ rsvp_intserv_print(netdissect_options *ndo, case 135: case 136: if (parameter_length == 4) { - ND_TCHECK_4(tptr + 4); ND_PRINT("\n\t\tValue: %u", GET_BE_U_4(tptr + 4)); } break; @@ -663,8 +653,8 @@ rsvp_intserv_print(netdissect_options *ndo, } return (parameter_length+4); /* header length 4 bytes */ -trunc: - nd_print_trunc(ndo); +invalid: + nd_print_invalid(ndo); return 0; } @@ -706,9 +696,6 @@ rsvp_obj_print(netdissect_options *ndo, u_int action, subchannel; while(tlen>=sizeof(struct rsvp_object_header)) { - /* did we capture enough for fully decoding the object header ? */ - ND_TCHECK_LEN(tptr, sizeof(struct rsvp_object_header)); - rsvp_obj_header = (const struct rsvp_object_header *)tptr; rsvp_obj_len=GET_BE_U_2(rsvp_obj_header->length); rsvp_obj_ctype=GET_U_1(rsvp_obj_header->ctype); @@ -1140,7 +1127,6 @@ rsvp_obj_print(netdissect_options *ndo, ND_PRINT(" ERROR: length != 8"); goto invalid; } - ND_TCHECK_8(obj_tptr); ND_PRINT(", Flags: [%s] (%#x), Class-Type: %s (%u), %u", bittok2str(rsvp_obj_rro_label_flag_values, "none", @@ -1266,8 +1252,7 @@ rsvp_obj_print(netdissect_options *ndo, * each iteration subobj_len may happen to be a multiple of 1 * and test it and total_subobj_len respectively. */ - if (total_subobj_len < 4) - goto invalid; + ND_LCHECK_U(total_subobj_len, 4); subobj_len = GET_BE_U_2(obj_tptr); subobj_type = (GET_BE_U_2(obj_tptr + 2))>>8; af = (GET_BE_U_2(obj_tptr + 2))&0x00FF; @@ -1918,9 +1903,6 @@ obj_tooshort: invalid: nd_print_invalid(ndo); return -1; -trunc: - nd_print_trunc(ndo); - return -1; } void @@ -2069,8 +2051,4 @@ rsvp_print(netdissect_options *ndo, print_unknown_data(ndo, tptr, "\n\t ", tlen); break; } - - return; -trunc: - nd_print_trunc(ndo); }