1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2026-05-13 17:03:07 +08: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:
rofl0r
2014-01-22 22:22:18 +01:00
Unverified
parent ca14801d52
commit 530fee89ce
+1 -1
View File
@@ -847,7 +847,7 @@ int proxy_getaddrinfo(const char *node, const char *service, const struct addrin
p->ai_addr = &space->sockaddr_space;
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_next = NULL;
p->ai_family = space->sockaddr_space.sa_family = AF_INET;