mirror of
https://github.com/rofl0r/proxychains-ng.git
synced 2024-12-21 19:58:47 +00:00
proxy_getaddrinfo: don't use strncpy
the strncpy function is both dangerous and slow. dangerous because it doesn't do what the naive programmer expects (bounded strcpy), and slow because it pads the entire bufsize with zeroes.
This commit is contained in:
parent
ca14801d52
commit
530fee89ce
@ -847,7 +847,7 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
|
|||||||
|
|
||||||
p->ai_addr = &space->sockaddr_space;
|
p->ai_addr = &space->sockaddr_space;
|
||||||
if(node)
|
if(node)
|
||||||
strncpy(space->addr_name, node, sizeof(space->addr_name));
|
snprintf(space->addr_name, sizeof(space->addr_name), "%s", node);
|
||||||
p->ai_canonname = space->addr_name;
|
p->ai_canonname = space->addr_name;
|
||||||
p->ai_next = NULL;
|
p->ai_next = NULL;
|
||||||
p->ai_family = space->sockaddr_space.sa_family = AF_INET;
|
p->ai_family = space->sockaddr_space.sa_family = AF_INET;
|
||||||
|
Loading…
Reference in New Issue
Block a user