]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
urlapi: skip a strlen(), pass in zero
authorDaniel Stenberg <daniel@haxx.se>
Fri, 15 Oct 2021 14:29:52 +0000 (16:29 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Fri, 15 Oct 2021 21:22:14 +0000 (23:22 +0200)
... to let curl_easy_escape() itself do the strlen. This avoids a (false
positive) Coverity warning and it avoids us having to store the strlen()
return value in an int variable.

Reviewed-by: Daniel Gustafsson
Closes #7862

lib/urlapi.c
tests/data/test1560

index 5c943c52cad7c7df37228589b94be3fb4db75b0b..6d116b61bf7fe13ee503134252642fe635e574a7 100644 (file)
@@ -1295,8 +1295,7 @@ CURLUcode curl_url_get(CURLU *u, CURLUPart what,
         }
       }
       else if(urlencode) {
-        int hostlen = (int)strlen(u->host);
-        allochost = curl_easy_escape(NULL, u->host, hostlen);
+        allochost = curl_easy_escape(NULL, u->host, 0);
         if(!allochost)
           return CURLUE_OUT_OF_MEMORY;
       }
index e8767b27bfe72466fe90eff7b3b375987bc82866..f6722fd419e8fcce3781f71b576f2ec81a87a5a7 100644 (file)
@@ -2,7 +2,7 @@
 <info>
 <keywords>
 unittest
-URL API
+URLAPI
 </keywords>
 </info>