diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2017-03-27 12:20:33 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2017-03-27 12:20:33 +0100 |
commit | 8e96e9bc27f332cf41589d97687f5cafbfda06c5 (patch) | |
tree | 8600b2e880ac5e4adf377814f7553adb6a6aa599 /utils/nsurl | |
parent | 13a2ac7c08161868987c929a8b66462fe752f2c7 (diff) | |
download | netsurf-8e96e9bc27f332cf41589d97687f5cafbfda06c5.tar.gz netsurf-8e96e9bc27f332cf41589d97687f5cafbfda06c5.tar.bz2 |
nsurl: Don't allow credentials or host for file: URLs.
Diffstat (limited to 'utils/nsurl')
-rw-r--r-- | utils/nsurl/parse.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/utils/nsurl/parse.c b/utils/nsurl/parse.c index 453c56523..a56a78d2d 100644 --- a/utils/nsurl/parse.c +++ b/utils/nsurl/parse.c @@ -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; |