diff options
author | Thomas Haller <thaller@redhat.com> | 2017-12-12 10:59:26 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-12-12 11:15:38 +0100 |
commit | c274b565a66e0c2932377554ce4d33a4772602e4 (patch) | |
tree | fc2045d204b72e12823ad82237585416f28fdbff | |
parent | 62d4dba74bac791c06ba70547f81b78eab5b9dc5 (diff) | |
download | NetworkManager-c274b565a66e0c2932377554ce4d33a4772602e4.tar.gz |
cli: avoid out-of-bounds-read for show_device_info()
Probably not critical, because it will still include
the terminating NULL, and just continue to fill the
temporary buffer with static addresses.
Found by coverity.
Fixes: bfb9fd0d2f3d602a69537fe7776426ee9202ce9e
-rw-r--r-- | clients/cli/devices.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clients/cli/devices.c b/clients/cli/devices.c index 8aad8b75c0..44ed7b35dd 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -1113,8 +1113,8 @@ show_device_info (NMDevice *device, NmCli *nmc) (const NMMetaAbstractInfo *const*) nmc_fields_dev_show_general, FALSE, NULL, NULL); - row = g_new0 (NmcOutputField, _NM_META_SETTING_TYPE_NUM + 1); - for (i = 0; i < _NM_META_SETTING_TYPE_NUM; i++) + row = g_new0 (NmcOutputField, G_N_ELEMENTS (nmc_fields_dev_show_general)); + for (i = 0; i < G_N_ELEMENTS (nmc_fields_dev_show_general); i++) row[i].info = (const NMMetaAbstractInfo *) &nmc_fields_dev_show_general[i]; print_required_fields (&nmc->nmc_config, NMC_OF_FLAG_MAIN_HEADER_ONLY, |