mirror of
https://github.com/curl/curl.git
synced 2026-08-24 21:43:32 +03:00
lib: strndup/memdup instead of malloc, memcpy and null-terminate
- bufref: use strndup - cookie: use strndup - formdata: use strndup - ftp: use strndup - gtls: use aprintf instead of malloc + strcpy * 2 - http: use strndup - mbedtls: use strndup - md4: use memdup - ntlm: use memdup - ntlm_sspi: use strndup - pingpong: use memdup - rtsp: use strndup instead of malloc, memcpy and null-terminate - sectransp: use strndup - socks_gssapi.c: use memdup - vtls: use dynbuf instead of malloc, snprintf and memcpy - vtls: use strdup instead of malloc + memcpy - wolfssh: use strndup Closes #12453
This commit is contained in:
parent
63cdaefbc3
commit
7309b9cbbf
16 changed files with 48 additions and 91 deletions
|
|
@ -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_strndup(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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue