aboutsummaryrefslogtreecommitdiff
path: root/toys/pending/dhcpd.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2015-01-01 16:59:35 -0600
committerRob Landley <rob@landley.net>2015-01-01 16:59:35 -0600
commit82effc97f9f2d1c258ea50cb11b130753b8ba805 (patch)
treef6c584d2b1675a91eb1a016977560ff7148c15a1 /toys/pending/dhcpd.c
parent5f53d130b1eae9041cc88c0ffb89e2b5823da393 (diff)
downloadtoybox-82effc97f9f2d1c258ea50cb11b130753b8ba805.tar.gz
Switch a lot of strncpy() calls to xstrncpy().
Diffstat (limited to 'toys/pending/dhcpd.c')
-rw-r--r--toys/pending/dhcpd.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/toys/pending/dhcpd.c b/toys/pending/dhcpd.c
index 2f0c3a54..9c3389cd 100644
--- a/toys/pending/dhcpd.c
+++ b/toys/pending/dhcpd.c
@@ -246,8 +246,7 @@ static int get_interface(const char *interface, int *ifindex, uint32_t *oip, uin
int fd = xsocket(AF_INET, SOCK_RAW, IPPROTO_RAW);
req.ifr_addr.sa_family = AF_INET;
- strncpy(req.ifr_name, interface, IFNAMSIZ);
- req.ifr_name[IFNAMSIZ-1] = '\0';
+ xstrncpy(req.ifr_name, interface, IFNAMSIZ);
xioctl(fd, SIOCGIFFLAGS, &req);
@@ -625,8 +624,7 @@ static int open_listensock(void)
return -1;
}
memset(&ifr, 0, sizeof(ifr));
- strncpy(ifr.ifr_name, gconfig.interface, IFNAMSIZ);
- ifr.ifr_name[IFNAMSIZ -1] = '\0';
+ xstrncpy(ifr.ifr_name, gconfig.interface, IFNAMSIZ);
setsockopt(gstate.listensock, SOL_SOCKET, SO_BINDTODEVICE, &ifr, sizeof(ifr));
memset(&addr, 0, sizeof(addr));