idn: if idn2_check_version returns NULL, return error

... this avoids a NULL dereference for this unusual case.

Reported-by: s0urc3_ on hackerone
Closes #11898
This commit is contained in:
Daniel Stenberg 2023-09-20 11:10:16 +02:00
parent 0d3956b8c6
commit 7cf269dd1c
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -174,6 +174,9 @@ static CURLcode idn_decode(const char *input, char **output)
if(rc != IDN2_OK)
result = CURLE_URL_MALFORMAT;
}
else
/* a too old libidn2 version */
result = CURLE_NOT_BUILT_IN;
#elif defined(USE_WIN32_IDN)
result = win32_idn_to_ascii(input, &decoded);
#endif