- type = EXTRACT_U_1(sp);
- len = EXTRACT_BE_U_2(sp + 1);
- if (len > 1500 || len < 3 || type == 0 || type > MSDP_TYPE_MAX)
- goto trunc; /* not really truncated, but still not decodable */
- ND_PRINT((ndo, " msdp:"));
- while (length > 0) {
- ND_TCHECK_3(sp);
- type = EXTRACT_U_1(sp);
- len = EXTRACT_BE_U_2(sp + 1);
+ type = GET_U_1(sp);
+ len = GET_BE_U_2(sp + 1);
+ ND_ICHECK_U(len, >, 1500);
+ ND_ICHECK_U(len, <, 3);
+ ND_ICHECK_U(type, ==, 0);
+ ND_ICHECK_U(type, >, MSDP_TYPE_MAX);
+ while (length != 0) {
+ unsigned int entry_count;
+
+ ND_ICHECK_U(length, <, 3);
+ type = GET_U_1(sp);
+ len = GET_BE_U_2(sp + 1);