mirror of
https://github.com/curl/curl.git
synced 2026-08-26 19:13:33 +03:00
tests: replace strcpy() with curlx_strcopy()
Also: - examples/hsts-preload: apply the same change as it's based on lib1915 in tests. Make a local clone of `curlx_strcopy()`. Then drop the `_CRT_SECURE_NO_WARNINGS` hack, that's no longer necessary. - curl_setup.h: delete `strcpy()` from the `_CRT_SECURE_NO_WARNINGS` list. Closes #20076
This commit is contained in:
parent
66aec526fc
commit
436e67f65b
9 changed files with 43 additions and 30 deletions
|
|
@ -101,9 +101,12 @@ static void socksd_resetdefaults(void)
|
|||
s_config.reqcmd = CONFIG_REQCMD;
|
||||
s_config.connectrep = CONFIG_CONNECTREP;
|
||||
s_config.port = CONFIG_PORT;
|
||||
strcpy(s_config.addr, CONFIG_ADDR);
|
||||
strcpy(s_config.user, "user");
|
||||
strcpy(s_config.password, "password");
|
||||
curlx_strcopy(s_config.addr, sizeof(s_config.addr),
|
||||
CONFIG_ADDR, strlen(CONFIG_ADDR));
|
||||
curlx_strcopy(s_config.user, sizeof(s_config.user),
|
||||
"user", strlen("user"));
|
||||
curlx_strcopy(s_config.password, sizeof(s_config.password),
|
||||
"password", strlen("password"));
|
||||
}
|
||||
|
||||
static void socksd_getconfig(void)
|
||||
|
|
@ -141,7 +144,8 @@ static void socksd_getconfig(void)
|
|||
}
|
||||
}
|
||||
else if(!strcmp(key, "backend")) {
|
||||
strcpy(s_config.addr, value);
|
||||
curlx_strcopy(s_config.addr, sizeof(s_config.addr),
|
||||
value, strlen(value));
|
||||
logmsg("backend [%s] set", s_config.addr);
|
||||
}
|
||||
else if(!strcmp(key, "backendport")) {
|
||||
|
|
@ -152,11 +156,13 @@ static void socksd_getconfig(void)
|
|||
}
|
||||
}
|
||||
else if(!strcmp(key, "user")) {
|
||||
strcpy(s_config.user, value);
|
||||
curlx_strcopy(s_config.user, sizeof(s_config.user),
|
||||
value, strlen(value));
|
||||
logmsg("user [%s] set", s_config.user);
|
||||
}
|
||||
else if(!strcmp(key, "password")) {
|
||||
strcpy(s_config.password, value);
|
||||
curlx_strcopy(s_config.password, sizeof(s_config.password),
|
||||
value, strlen(value));
|
||||
logmsg("password [%s] set", s_config.password);
|
||||
}
|
||||
/* Methods:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue