The isc_url_parse() function failed to check the input buffer's
length and assumed that it can't be bigger than UINT16_MAX, because
both the 'off' and 'len' fields of the 'isc_url_parser_t' structure
are uint16_t.
Add a check to not accept a buffer longer than UINT16_MAX.
int found_at = 0;
const char *p = NULL;
- if (buflen == 0) {
- return ISC_R_FAILURE;
+ if (buflen == 0 || buflen > UINT16_MAX) {
+ return ISC_R_RANGE;
}
up->port = up->field_set = 0;