mirror of
https://github.com/curl/curl.git
synced 2026-08-26 08:13:32 +03:00
lib: rename Curl_strndup to Curl_memdup0 to avoid misunderstanding
Since the copy does not stop at a null byte, let's not call it anything that makes you think it works like the common strndup() function. Based on feedback from Jay Satiro, Stefan Eissing and Patrick Monnerat Closes #12490
This commit is contained in:
parent
6d8dc2f636
commit
7c992dd9f8
15 changed files with 27 additions and 27 deletions
|
|
@ -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,7 +821,7 @@ 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 = Curl_strndup(path, pathlen);
|
||||
co->path = Curl_memdup0(path, pathlen);
|
||||
if(co->path) {
|
||||
co->spath = sanitize_cookie_path(co->path);
|
||||
if(!co->spath)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue