platform: use memset() to initialize ifr struct in _ioctl_call()

"struct ifreq" contains a union field, and initalizing the struct is not
guaranteed to fill all bytes with zero (it only sets the first union
member to zero).

Since we later return the entire struct, ensure that it's initialized to
all zero by using memset().
This commit is contained in:
Thomas Haller 2019-05-15 21:00:52 +02:00
parent d0e1d0e626
commit 065d891402

View file

@ -173,9 +173,7 @@ again:
nm_assert (ifname && nm_utils_is_valid_iface_name (ifname, NULL));
nm_assert (fd >= 0);
ifr = (struct ifreq) {
.ifr_data = NULL,
};
memset (&ifr, 0, sizeof (ifr));
memcpy (ifr.ifr_name, ifname, IFNAMSIZ);
if (edata_type == IOCTL_CALL_DATA_TYPE_IFRDATA)
ifr.ifr_data = edata;