Make the function tolerate a NULL pointer input to avoid dereferencing
that pointer.
Follow-up to
efce3ea5a85126d
Detected by OSS-Fuzz
Reviewed-By: Steve Holme
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=20907
Fixes #4985
Closes #4986
and send the host name using UTF-8 rather than as 7-bit ACE (which is
our preference) */
}
- else
- host->name = NULL;
/* Extract the local address from the mailbox */
*address = dup;
*/
bool Curl_is_ASCII_name(const char *hostname)
{
+ /* get an UNSIGNED local version of the pointer */
const unsigned char *ch = (const unsigned char *)hostname;
+ if(!hostname) /* bad input, consider it ASCII! */
+ return TRUE;
+
while(*ch) {
if(*ch++ & 0x80)
return FALSE;