13
0

fix strncpy() size argument error (Windows only, needs review)

This commit is contained in:
Paul Davis 2022-06-21 18:40:57 -06:00
parent 9b80d6558a
commit 660d2fc8ab

View File

@ -116,7 +116,7 @@ get_address (int sock, struct in_addr *inaddr, const string& ifname )
// Get interface address from supplied name. // Get interface address from supplied name.
struct ifreq ifr; struct ifreq ifr;
::strncpy(ifr.ifr_name, ifname.c_str(), sizeof(ifr.ifr_name)); ::strncpy(ifr.ifr_name, ifname.c_str(), sizeof(ifr.ifr_name) - 1);
if (::ioctl(sock, SIOCGIFFLAGS, (char *) &ifr)) { if (::ioctl(sock, SIOCGIFFLAGS, (char *) &ifr)) {
::perror("ioctl(SIOCGIFFLAGS)"); ::perror("ioctl(SIOCGIFFLAGS)");