diff options
author | Daniel Stenberg <daniel@haxx.se> | 2023-02-24 18:17:33 +0100 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2023-02-27 15:12:29 +0100 |
commit | cf3e6ce92f1c9686129d0fd4a5d39c0fb38792ec (patch) | |
tree | 5336ae7bc25263faa9506a2304703f17fb03b695 /lib/idn.c | |
parent | 49a9f13c3997494aee368f0b2c4104b370f509e6 (diff) | |
download | curl-cf3e6ce92f1c9686129d0fd4a5d39c0fb38792ec.tar.gz |
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
Diffstat (limited to 'lib/idn.c')
-rw-r--r-- | lib/idn.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -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 */ |