summaryrefslogtreecommitdiffstats
path: root/lib/libutil/realhostname.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libutil/realhostname.c')
-rw-r--r--lib/libutil/realhostname.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/libutil/realhostname.c b/lib/libutil/realhostname.c
index 6a1b82f..146695e 100644
--- a/lib/libutil/realhostname.c
+++ b/lib/libutil/realhostname.c
@@ -61,8 +61,7 @@ realhostname(char *host, size_t hsize, const struct in_addr *ip)
if (strlen(trimmed) <= hsize) {
char lookup[MAXHOSTNAMELEN];
- strncpy(lookup, hp->h_name, sizeof(lookup) - 1);
- lookup[sizeof(lookup) - 1] = '\0';
+ strlcpy(lookup, hp->h_name, sizeof(lookup));
hp = gethostbyname(lookup);
if (hp == NULL)
result = HOSTNAME_INVALIDNAME;
OpenPOWER on IntegriCloud