summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorume <ume@FreeBSD.org>2003-08-16 20:19:20 +0000
committerume <ume@FreeBSD.org>2003-08-16 20:19:20 +0000
commit77de7395bb256ac2af052c6aec8436c6c3a7bb7f (patch)
tree4b55eb404d030bc4a2e1acfec87f778bb3a3ffe1
parent1e402645a451e1dcaad15928aaeda5919b44449a (diff)
downloadFreeBSD-src-77de7395bb256ac2af052c6aec8436c6c3a7bb7f.zip
FreeBSD-src-77de7395bb256ac2af052c6aec8436c6c3a7bb7f.tar.gz
use strlcpy().
Pointed out by: Pawel Jakub Dawidek <nick@garage.freebsd.pl> MFC after: 1 week
-rw-r--r--usr.sbin/rtsold/if.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/usr.sbin/rtsold/if.c b/usr.sbin/rtsold/if.c
index 0ea3922..aa191e4 100644
--- a/usr.sbin/rtsold/if.c
+++ b/usr.sbin/rtsold/if.c
@@ -80,7 +80,7 @@ interface_up(char *name)
struct ifreq ifr;
int llflag;
- strncpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, name, sizeof(ifr.ifr_name));
if (ioctl(ifsock, SIOCGIFFLAGS, (caddr_t)&ifr) < 0) {
warnmsg(LOG_WARNING, __func__, "ioctl(SIOCGIFFLAGS): %s",
@@ -129,7 +129,7 @@ interface_status(struct ifinfo *ifinfo)
/* get interface flags */
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
+ strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name));
if (ioctl(ifsock, SIOCGIFFLAGS, &ifr) < 0) {
warnmsg(LOG_ERR, __func__, "ioctl(SIOCGIFFLAGS) on %s: %s",
ifname, strerror(errno));
@@ -147,7 +147,7 @@ interface_status(struct ifinfo *ifinfo)
if (!ifinfo->mediareqok)
goto active;
memset(&ifmr, 0, sizeof(ifmr));
- strncpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
+ strlcpy(ifmr.ifm_name, ifname, sizeof(ifmr.ifm_name));
if (ioctl(ifsock, SIOCGIFMEDIA, (caddr_t)&ifmr) < 0) {
if (errno != EINVAL) {
@@ -333,7 +333,7 @@ get_llflag(const char *name)
continue;
memset(&ifr6, 0, sizeof(ifr6));
- strncpy(ifr6.ifr_name, name, sizeof(ifr6.ifr_name));
+ strlcpy(ifr6.ifr_name, name, sizeof(ifr6.ifr_name));
memcpy(&ifr6.ifr_ifru.ifru_addr, sin6, sin6->sin6_len);
if (ioctl(s, SIOCGIFAFLAG_IN6, &ifr6) < 0) {
warnmsg(LOG_ERR, __func__,
OpenPOWER on IntegriCloud