idn: reject conversions that end up as a zero length hostname

Reported-by: RepoRascal on hackerone
Closes #18462
This commit is contained in:
Daniel Stenberg 2025-09-03 09:41:29 +02:00
parent 8603d5262b
commit 967a626af4
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2

View file

@ -323,8 +323,12 @@ CURLcode Curl_idn_decode(const char *input, char **output)
result = CURLE_OUT_OF_MEMORY; result = CURLE_OUT_OF_MEMORY;
} }
#endif #endif
if(!result) if(!result) {
*output = d; if(!d[0]) /* ended up zero length, not acceptable */
result = CURLE_URL_MALFORMAT;
else
*output = d;
}
return result; return result;
} }