summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-05-15 21:00:52 +0200
committerThomas Haller <thaller@redhat.com>2019-05-16 08:51:56 +0200
commit065d891402bc37d50378825ad81dfecfd6fbbea2 (patch)
tree0daa1525c1d8676b3605ac26dc369ee1dde36eec
parentd0e1d0e626d18971efaaff60dfc04b71137d6a62 (diff)
downloadNetworkManager-065d891402bc37d50378825ad81dfecfd6fbbea2.tar.gz
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().
-rw-r--r--src/platform/nm-platform-utils.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/platform/nm-platform-utils.c b/src/platform/nm-platform-utils.c
index 4eaea41bc5..df0efa270d 100644
--- a/src/platform/nm-platform-utils.c
+++ b/src/platform/nm-platform-utils.c
@@ -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;