nsurl: Don't allow credentials or host for file: URLs.

This commit is contained in:
Michael Drake 2017-03-27 12:20:33 +01:00
parent 13a2ac7c08
commit 8e96e9bc27
1 changed files with 10 additions and 0 deletions

View File

@ -818,6 +818,11 @@ static nserror nsurl__create_from_section(const char * const url_s,
url->username = NULL;
url->password = NULL;
/* file: URLs don't have credentials */
if (url->scheme_type == NSURL_SCHEME_FILE) {
break;
}
if (length != 0 && *norm_start != ':') {
char *sec_start = norm_start;
if (pegs->colon_first != pegs->authority &&
@ -854,6 +859,11 @@ static nserror nsurl__create_from_section(const char * const url_s,
url->host = NULL;
url->port = NULL;
/* file: URLs don't have a host */
if (url->scheme_type == NSURL_SCHEME_FILE) {
break;
}
if (length != 0) {
size_t colon = 0;
char *sec_start = norm_start;