]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
urlapi: remove an unnecessary call to strlen
authorHenrikHolst <henrik.holst@millistream.com>
Tue, 1 Feb 2022 12:50:21 +0000 (13:50 +0100)
committerJay Satiro <raysatiro@yahoo.com>
Tue, 1 Feb 2022 20:43:45 +0000 (15:43 -0500)
- Use strcpy instead of strlen+memcpy to copy the url path.

Ref: https://curl.se/mail/lib-2022-02/0006.html

Closes https://github.com/curl/curl/pull/8370

lib/urlapi.c

index d29aeb238f68adc7d7b926cb07c1a17036b2237f..66d6bf487f080e74a93e6621e954e4b1da91fe2e 100644 (file)
@@ -1005,9 +1005,7 @@ static CURLUcode seturl(const char *url, CURLU *u, unsigned int flags)
         return CURLUE_NO_HOST;
     }
 
-    len = strlen(p);
-    memcpy(path, p, len);
-    path[len] = 0;
+    strcpy(path, p);
 
     if(schemep) {
       u->scheme = strdup(schemep);