aboutsummaryrefslogtreecommitdiff
path: root/libntp/decodenetnum.c
diff options
context:
space:
mode:
Diffstat (limited to 'libntp/decodenetnum.c')
-rw-r--r--libntp/decodenetnum.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libntp/decodenetnum.c b/libntp/decodenetnum.c
index f265daebf9c6..187d5cae7e5b 100644
--- a/libntp/decodenetnum.c
+++ b/libntp/decodenetnum.c
@@ -51,8 +51,7 @@ decodenetnum(
else if (NULL != strchr(pp + 1, ':'))
cp = num; /* two or more colons */
else { /* one colon */
- strncpy(name, num, sizeof(name));
- name[sizeof(name) - 1] = '\0';
+ strlcpy(name, num, sizeof(name));
cp = name;
pp = strchr(cp, ':');
*pp = '\0';
@@ -74,6 +73,7 @@ decodenetnum(
if (err != 0)
return 0;
NTP_INSIST(ai->ai_addrlen <= sizeof(*netnum));
+ ZERO(*netnum);
memcpy(netnum, ai->ai_addr, ai->ai_addrlen);
freeaddrinfo(ai);
if (NULL == port_str || 1 != sscanf(port_str, "%hu", &port))