mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-28 22:40:10 +01:00
nmcli: fix crash in "nmcli device monitor"
Fix the following crash:
$ nmcli device monitor a
Error: Device 'a' not found.
Segmentation fault (core dumped)
Found by coverity:
1. NetworkManager-1.41.3/src/nmcli/devices.c:0: scope_hint: In function 'do_devices_monitor'
2. NetworkManager-1.41.3/src/nmcli/devices.c:2932:28: warning[-Wanalyzer-null-dereference]: dereference of NULL 'devices'
2930| }
2931|
2932|-> for (i = 0; i < devices->len; i++)
2933| device_watch(nmc, g_ptr_array_index(devices, i));
2934|
Fixes: 2074b28976 ('nmcli/devices: return GPtrArray instead of GSList from get_device_list()')
This commit is contained in:
parent
4ffb7cba7b
commit
40897db056
1 changed files with 2 additions and 0 deletions
|
|
@ -2920,6 +2920,8 @@ do_devices_monitor(const NMCCommand *cmd, NmCli *nmc, int argc, const char *cons
|
|||
nmc->return_value = NMC_RESULT_ERROR_USER_INPUT;
|
||||
return;
|
||||
}
|
||||
if (!devices)
|
||||
return;
|
||||
} else {
|
||||
/* No devices specified. Monitor all. */
|
||||
devices = nm_client_get_devices(nmc->client);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue