]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
idn: if idn2_check_version returns NULL, return error
authorDaniel Stenberg <daniel@haxx.se>
Wed, 20 Sep 2023 09:10:16 +0000 (11:10 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 20 Sep 2023 11:36:51 +0000 (13:36 +0200)
... this avoids a NULL dereference for this unusual case.

Reported-by: s0urc3_ on hackerone
Closes #11898

lib/idn.c

index 1f31a9546c3a59c4f96b48ed459e59140a8caf80..475d9c9bebe15779dd814012292b7af8e04a0ef8 100644 (file)
--- a/lib/idn.c
+++ b/lib/idn.c
@@ -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