summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2021-10-15 16:29:52 +0200
committerDaniel Stenberg <daniel@haxx.se>2021-10-15 16:29:52 +0200
commitf7d27500c909538d499dcf5e9386bf1d11559af1 (patch)
treed97f6454cbe447e7c11f2d792675770fb004e8b6
parentb75045aa12a96411649a16b4703c4293ff7c16bd (diff)
downloadcurl-bagder/urlapi-skip-strlen.tar.gz
urlapi: skip a strlen(), pass in zerobagder/urlapi-skip-strlen
... 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.
-rw-r--r--lib/urlapi.c3
-rw-r--r--tests/data/test15602
2 files changed, 2 insertions, 3 deletions
diff --git a/lib/urlapi.c b/lib/urlapi.c
index 5c943c52c..6d116b61b 100644
--- a/lib/urlapi.c
+++ b/lib/urlapi.c
@@ -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;
}
diff --git a/tests/data/test1560 b/tests/data/test1560
index e8767b27b..f6722fd41 100644
--- a/tests/data/test1560
+++ b/tests/data/test1560
@@ -2,7 +2,7 @@
<info>
<keywords>
unittest
-URL API
+URLAPI
</keywords>
</info>