mirror of
https://github.com/curl/curl.git
synced 2026-08-25 08:43:31 +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
|
|
@ -368,7 +368,7 @@ mbed_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
|
|||
/* Unfortunately, mbedtls_x509_crt_parse() requires the data to be null
|
||||
terminated even when provided the exact length, forcing us to waste
|
||||
extra memory here. */
|
||||
unsigned char *newblob = Curl_strndup(ca_info_blob->data,
|
||||
unsigned char *newblob = Curl_memdup0(ca_info_blob->data,
|
||||
ca_info_blob->len);
|
||||
if(!newblob)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
|
@ -441,7 +441,7 @@ mbed_connect_step1(struct Curl_cfilter *cf, struct Curl_easy *data)
|
|||
/* Unfortunately, mbedtls_x509_crt_parse() requires the data to be null
|
||||
terminated even when provided the exact length, forcing us to waste
|
||||
extra memory here. */
|
||||
unsigned char *newblob = Curl_strndup(ssl_cert_blob->data,
|
||||
unsigned char *newblob = Curl_memdup0(ssl_cert_blob->data,
|
||||
ssl_cert_blob->len);
|
||||
if(!newblob)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
|
|
|||
|
|
@ -2373,7 +2373,7 @@ static CURLcode verify_cert(struct Curl_cfilter *cf,
|
|||
|
||||
if(ca_info_blob) {
|
||||
CURL_TRC_CF(data, cf, "verify_peer, CA from config blob");
|
||||
certbuf = (unsigned char *)Curl_strndup(ca_info_blob->data,
|
||||
certbuf = (unsigned char *)Curl_memdup0(ca_info_blob->data,
|
||||
buflen = ca_info_blob->len);
|
||||
if(!certbuf)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue