mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-26 18:10:08 +01:00
ifcfg-rh: avoid coverity false positive in write_secrets()
Comparing @secrets_keys indicates to coverity that it might be NULL.
Below, we access @secrets_keys without check, and coverity doesn't realize
that this cannot crash, because secrets_keys_n would be zero too.
Anyway, this way we safe the sorting, in case we only have
one element.
(cherry picked from commit cfdb962ebd)
This commit is contained in:
parent
ee77657727
commit
2dcf08402c
1 changed files with 1 additions and 1 deletions
|
|
@ -150,7 +150,7 @@ write_secrets (shvarFile *ifcfg,
|
|||
|
||||
/* sort the keys. */
|
||||
secrets_keys = (const char **) g_hash_table_get_keys_as_array (secrets, &secrets_keys_n);
|
||||
if (secrets_keys) {
|
||||
if (secrets_keys_n > 1) {
|
||||
g_qsort_with_data (secrets_keys,
|
||||
secrets_keys_n,
|
||||
sizeof (const char *),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue