aboutsummaryrefslogtreecommitdiffstats
path: root/url.c
diff options
context:
space:
mode:
authorTatsuya Kinoshita <tats@debian.org>2016-11-17 11:19:55 +0000
committerTatsuya Kinoshita <tats@debian.org>2016-11-19 12:26:24 +0000
commit62de166f5531faae1e4ac36de32e27d566d4beb9 (patch)
tree30ef93aad909a17f5acb8e3b9388640ae388a436 /url.c
parentPrevent deref null pointer in HTMLlineproc0() (diff)
downloadw3m-62de166f5531faae1e4ac36de32e27d566d4beb9.tar.gz
w3m-62de166f5531faae1e4ac36de32e27d566d4beb9.zip
Prevent global-buffer-overflow in parseURL()
Bug-Debian: https://github.com/tats/w3m/issues/41 Origin: https://anonscm.debian.org/cgit/collab-maint/w3m.git/commit/?id=ba9d78faeba9024c3e8840579c3b0e959ae2cb0f
Diffstat (limited to '')
-rw-r--r--url.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/url.c b/url.c
index 10089ca..fc213da 100644
--- a/url.c
+++ b/url.c
@@ -841,7 +841,10 @@ parseURL(char *url, ParsedURL *p_url, ParsedURL *current)
case '#':
p_url->host = copyPath(q, p - q,
COPYPATH_SPC_IGNORE | COPYPATH_LOWERCASE);
- p_url->port = DefaultPort[p_url->scheme];
+ if (p_url->scheme != SCM_UNKNOWN)
+ p_url->port = DefaultPort[p_url->scheme];
+ else
+ p_url->port = 0;
break;
}
analyze_file: