diff options
author | Rob Landley <rob@landley.net> | 2015-01-01 16:59:35 -0600 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2015-01-01 16:59:35 -0600 |
commit | 82effc97f9f2d1c258ea50cb11b130753b8ba805 (patch) | |
tree | f6c584d2b1675a91eb1a016977560ff7148c15a1 /toys/pending/dhcpd.c | |
parent | 5f53d130b1eae9041cc88c0ffb89e2b5823da393 (diff) | |
download | toybox-82effc97f9f2d1c258ea50cb11b130753b8ba805.tar.gz |
Switch a lot of strncpy() calls to xstrncpy().
Diffstat (limited to 'toys/pending/dhcpd.c')
-rw-r--r-- | toys/pending/dhcpd.c | 6 |
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)); |