diff options
Diffstat (limited to 'libs/libcurl/src/cookie.c')
| -rw-r--r-- | libs/libcurl/src/cookie.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/libs/libcurl/src/cookie.c b/libs/libcurl/src/cookie.c index 03f9699bd4..73ca6282d5 100644 --- a/libs/libcurl/src/cookie.c +++ b/libs/libcurl/src/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 {
|
