fix strncpy() size argument error (Windows only, needs review)
This commit is contained in:
parent
9b80d6558a
commit
660d2fc8ab
@ -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)");
|
||||||
|
Loading…
Reference in New Issue
Block a user