Fix null dereference 61/254261/1 accepted/tizen/base/20210307.082104 submit/tizen_base/20210303.015359
authorSeonah Moon <seonah1.moon@samsung.com>
Thu, 25 Feb 2021 06:07:39 +0000 (15:07 +0900)
committerSeonah Moon <seonah1.moon@samsung.com>
Thu, 25 Feb 2021 06:08:03 +0000 (15:08 +0900)
Change-Id: I4c535d1876d38b460f88f41c168fc5ad7f1235de

lib/url.c

index 033e557..625dbfe 100644 (file)
--- a/lib/url.c
+++ b/lib/url.c
@@ -1573,6 +1573,8 @@ CURLcode Curl_idnconvert_hostname(struct connectdata *conn,
     }
 #elif defined(USE_ICU_IDNA)
     char *ace_hostname = malloc(MAX_DOMAIN_NAME_LEN * sizeof(char));
+    if(!ace_hostname)
+      return CURLE_OUT_OF_MEMORY;
     UErrorCode errorCode = U_ZERO_ERROR;
     UIDNAInfo info = UIDNA_INFO_INITIALIZER;
     UIDNA *uts46 =
@@ -1584,7 +1586,7 @@ CURLcode Curl_idnconvert_hostname(struct connectdata *conn,
     uidna_close(uts46);
 
     if(errorCode != U_ZERO_ERROR || info.errors || length < 1) {
-      infof(data, "Failed to convert %s to ACE;\n", host->name);
+      failf(data, "Failed to convert %s to ACE;\n", host->name);
       return CURLE_URL_MALFORMAT;
     }
     else {