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
1 changed files with 1 additions and 1 deletions

View File

@ -116,7 +116,7 @@ get_address (int sock, struct in_addr *inaddr, const string& ifname )
// Get interface address from supplied name.
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)) {
::perror("ioctl(SIOCGIFFLAGS)");