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.
pull/35/merge
rofl0r 2014-01-22 22:22:18 +01:00
parent ca14801d52
commit 530fee89ce
1 changed files with 1 additions and 1 deletions

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;