mirror of
https://github.com/curl/curl.git
synced 2026-08-01 07:38:02 +03:00
curlx: curlx_strcopy() instead of strcpy()
This function REQUIRES the size of the target buffer as well as the length of the source string. Meant to make it harder to do a bad strcpy(). Removes 23 calls to strcpy(). Closes #20067
This commit is contained in:
parent
f099c2ca55
commit
a535be4ea0
30 changed files with 195 additions and 97 deletions
|
|
@ -108,9 +108,7 @@ static void memory_tracking_init(void)
|
|||
if(env) {
|
||||
/* use the value as filename */
|
||||
char fname[512];
|
||||
if(strlen(env) >= sizeof(fname))
|
||||
env[sizeof(fname) - 1] = '\0';
|
||||
strcpy(fname, env);
|
||||
curlx_strcopy(fname, sizeof(fname), env, strlen(env));
|
||||
curl_free(env);
|
||||
curl_dbg_memdebug(fname);
|
||||
/* this weird stuff here is to make curl_free() get called before
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue