summaryrefslogtreecommitdiff
path: root/utils/nsurl/parse.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2017-03-27 12:20:33 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2017-03-27 12:20:33 +0100
commit8e96e9bc27f332cf41589d97687f5cafbfda06c5 (patch)
tree8600b2e880ac5e4adf377814f7553adb6a6aa599 /utils/nsurl/parse.c
parent13a2ac7c08161868987c929a8b66462fe752f2c7 (diff)
downloadnetsurf-8e96e9bc27f332cf41589d97687f5cafbfda06c5.tar.gz
netsurf-8e96e9bc27f332cf41589d97687f5cafbfda06c5.tar.bz2
nsurl: Don't allow credentials or host for file: URLs.
Diffstat (limited to 'utils/nsurl/parse.c')
-rw-r--r--utils/nsurl/parse.c10
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;