summaryrefslogtreecommitdiffstats
path: root/Utilities/cmcurl/lib/cookie.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2024-01-31 15:02:45 (GMT)
committerBrad King <brad.king@kitware.com>2024-01-31 15:02:45 (GMT)
commite28ea90c1be2e7d3963effa3f7d80f2c8bf3d1d4 (patch)
tree61d94e6d1e595c9ab06bac9e70a153162f523ab8 /Utilities/cmcurl/lib/cookie.c
parent692463d271c5afae5c48b8f05117a9a2e035d6be (diff)
parent851cc904a0f3615c9560a2eeba83e04556c0090b (diff)
downloadCMake-e28ea90c1be2e7d3963effa3f7d80f2c8bf3d1d4.zip
CMake-e28ea90c1be2e7d3963effa3f7d80f2c8bf3d1d4.tar.gz
CMake-e28ea90c1be2e7d3963effa3f7d80f2c8bf3d1d4.tar.bz2
Merge branch 'upstream-curl' into update-curl
* upstream-curl: curl 2024-01-31 (5ce164e0)
Diffstat (limited to 'Utilities/cmcurl/lib/cookie.c')
-rw-r--r--Utilities/cmcurl/lib/cookie.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/Utilities/cmcurl/lib/cookie.c b/Utilities/cmcurl/lib/cookie.c
index 9095cea..dc319b6 100644
--- a/Utilities/cmcurl/lib/cookie.c
+++ b/Utilities/cmcurl/lib/cookie.c
@@ -365,7 +365,7 @@ static void strstore(char **str, const char *newstr, size_t len)
DEBUGASSERT(newstr);
DEBUGASSERT(str);
free(*str);
- *str = Curl_strndup(newstr, len);
+ *str = Curl_memdup0(newstr, len);
}
/*
@@ -821,10 +821,8 @@ Curl_cookie_add(struct Curl_easy *data,
endslash = memrchr(path, '/', (queryp - path));
if(endslash) {
size_t pathlen = (endslash-path + 1); /* include end slash */
- co->path = malloc(pathlen + 1); /* one extra for the zero byte */
+ co->path = Curl_memdup0(path, pathlen);
if(co->path) {
- memcpy(co->path, path, pathlen);
- co->path[pathlen] = 0; /* null-terminate */
co->spath = sanitize_cookie_path(co->path);
if(!co->spath)
badcookie = TRUE; /* out of memory bad */
@@ -927,7 +925,7 @@ Curl_cookie_add(struct Curl_easy *data,
if(!co->spath)
badcookie = TRUE;
fields++; /* add a field and fall down to secure */
- /* FALLTHROUGH */
+ FALLTHROUGH();
case 3:
co->secure = FALSE;
if(strcasecompare(ptr, "TRUE")) {
@@ -1229,7 +1227,7 @@ struct CookieInfo *Curl_cookie_init(struct Curl_easy *data,
if(data) {
FILE *fp = NULL;
- if(file) {
+ if(file && *file) {
if(!strcmp(file, "-"))
fp = stdin;
else {