diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/urlapi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/urlapi.c b/lib/urlapi.c index 6919ff1bd..3af8e9399 100644 --- a/lib/urlapi.c +++ b/lib/urlapi.c @@ -510,8 +510,11 @@ UNITTEST CURLUcode Curl_parse_port(struct Curl_URL *u, char *hostname) portptr = &hostname[len]; else if('%' == endbracket) { int zonelen = len; - if(1 == sscanf(hostname + zonelen, "25%*[^]]]%c%n", &endbracket, &len)) - portptr = &hostname[--zonelen + len]; + if(1 == sscanf(hostname + zonelen, "25%*[^]]%c%n", &endbracket, &len)) { + if(']' != endbracket) + return CURLUE_MALFORMED_INPUT; + portptr = &hostname[--zonelen + len + 1]; + } else return CURLUE_MALFORMED_INPUT; } |