summaryrefslogtreecommitdiff
path: root/inet/getnameinfo.c
diff options
context:
space:
mode:
Diffstat (limited to 'inet/getnameinfo.c')
-rw-r--r--inet/getnameinfo.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/inet/getnameinfo.c b/inet/getnameinfo.c
index 28713e1f85..709f9ecbfe 100644
--- a/inet/getnameinfo.c
+++ b/inet/getnameinfo.c
@@ -243,6 +243,8 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
{
strncpy (host, h->h_name,
min(hostlen, (size_t) (c - h->h_name)));
+ host[min(hostlen - 1, (size_t) (c - h->h_name))]
+ = '\0';
break;
}
}