mirror of
https://github.com/curl/curl.git
synced 2025-03-31 16:00:35 +08:00
idn: return error if the conversion ends up with a blank host
Some IDN sequences are converted into "" (nothing), which can make this function end up with a zero length host name and we cannot consider that a valid host to continue with. Reported-by: Maciej Domanski Closes #10617
This commit is contained in:
parent
49a9f13c39
commit
cf3e6ce92f
@ -184,6 +184,11 @@ CURLcode Curl_idnconvert_hostname(struct hostname *host)
|
||||
if(!Curl_is_ASCII_name(host->name)) {
|
||||
char *decoded = idn_decode(host->name);
|
||||
if(decoded) {
|
||||
if(!*decoded) {
|
||||
/* zero length is a bad host name */
|
||||
Curl_idn_free(decoded);
|
||||
return CURLE_URL_MALFORMAT;
|
||||
}
|
||||
/* successful */
|
||||
host->encalloc = decoded;
|
||||
/* change the name pointer to point to the encoded hostname */
|
||||
|
Loading…
x
Reference in New Issue
Block a user