mirror of
https://github.com/curl/curl.git
synced 2026-07-28 08:13:08 +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
|
|
@ -509,7 +509,7 @@ static CURLUcode ipv6_parse(struct Curl_URL *u, char *hostname,
|
|||
hostname[hlen] = 0; /* end the address there */
|
||||
if(curlx_inet_pton(AF_INET6, hostname, dest) != 1)
|
||||
return CURLUE_BAD_IPV6;
|
||||
if(curlx_inet_ntop(AF_INET6, dest, hostname, hlen)) {
|
||||
if(curlx_inet_ntop(AF_INET6, dest, hostname, hlen + 1)) {
|
||||
hlen = strlen(hostname); /* might be shorter now */
|
||||
hostname[hlen + 1] = 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue