urlapi: skip a strlen(), pass in zero

... 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
This commit is contained in:
Daniel Stenberg 2021-10-15 16:29:52 +02:00
parent ccb466fd36
commit efffa66f65
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2
2 changed files with 2 additions and 3 deletions

View 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;
}

View File

@ -2,7 +2,7 @@
<info>
<keywords>
unittest
URL API
URLAPI
</keywords>
</info>