- if (bodylen < 9 || bodylen < 9 + (value[8] + 7) / 8)
- goto invalid;
- ND_PRINT((ndo, " VLSO: %s PLSO: %s Prefix: ",
- format_interval(EXTRACT_32BITS(value)),
- format_interval(EXTRACT_32BITS(value + 4))
- ));
- if ((l = print_prefix(ndo, value + 8, bodylen - 8)) < 0)
- goto invalid;
+ if (bodylen < 9 || bodylen < 9 + (GET_U_1(value + 8) + 7) / 8) {
+ nd_print_invalid(ndo);
+ break;
+ }
+ ND_PRINT(" VLSO: %s PLSO: %s Prefix: ",
+ format_interval(GET_BE_U_4(value)),
+ format_interval(GET_BE_U_4(value + 4))
+ );
+ l = print_prefix(ndo, value + 8, bodylen - 8);
+ if (l == -1) {
+ ND_PRINT("(length is invalid)");
+ break;
+ }
+ if (l < 0) {
+ /*
+ * We've already checked that we've captured the
+ * entire TLV, based on its length, so this will
+ * either be -1, meaning "the prefix length is
+ * greater than the longest possible address of
+ * that type" (i.e., > 32 for IPv4 or > 128 for
+ * IPv6", or -3, meaning "the prefix runs past
+ * the end of the TLV".
+ */
+ nd_print_invalid(ndo);
+ break;
+ }