mirror of
https://github.com/curl/curl.git
synced 2026-07-24 17:57:18 +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
|
|
@ -603,7 +603,7 @@ CURLFORMcode FormAdd(struct curl_httppost **httppost,
|
|||
app passed in a bad combo, so we better check for that first. */
|
||||
if(form->name) {
|
||||
/* copy name (without strdup; possibly not null-terminated) */
|
||||
form->name = Curl_strndup(form->name, form->namelength?
|
||||
form->name = Curl_memdup0(form->name, form->namelength?
|
||||
form->namelength:
|
||||
strlen(form->name));
|
||||
}
|
||||
|
|
@ -779,7 +779,7 @@ static CURLcode setname(curl_mimepart *part, const char *name, size_t len)
|
|||
|
||||
if(!name || !len)
|
||||
return curl_mime_name(part, name);
|
||||
zname = Curl_strndup(name, len);
|
||||
zname = Curl_memdup0(name, len);
|
||||
if(!zname)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
res = curl_mime_name(part, zname);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue