mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 07:30:10 +01:00
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:
parent
d0e1d0e626
commit
065d891402
1 changed files with 1 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue