tap-bridge: Fix -Werror=stringop-truncation with GCC 8

This commit is contained in:
Stefano Avallone
2018-06-07 11:14:56 +02:00
parent 598e2726bf
commit 4e24485c24

View File

@@ -639,7 +639,8 @@ TapBridge::CreateTap (void)
// mac address
//
struct ifreq s;
strncpy (s.ifr_name, m_tapDeviceName.c_str (), sizeof (s.ifr_name));
memset (&s, 0, sizeof(struct ifreq));
strncpy (s.ifr_name, m_tapDeviceName.c_str (), IFNAMSIZ - 1);
NS_LOG_INFO ("Trying to get MacAddr of " << m_tapDeviceName);
int ioctlResult = ioctl (sock, SIOCGIFHWADDR, &s);