libnm: fix update of cached option names in nm_setting_option_set()

This is severe. We cache the list of names, and we must invalidate the
cache when the names change. Otherwise, out-of-bound access and crash.

Fixes: d0192b698e ('libnm: add nm_setting_option_set(), nm_setting_option_get_boolean(), nm_setting_option_set_boolean()')
Fixes: 150af44e10 ('libnm: add nm_setting_option_get_uint32(), nm_setting_option_set_uint32()')
This commit is contained in:
Thomas Haller 2022-03-23 14:59:00 +01:00
parent 681926ad43
commit 22dcfb3a67
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -3975,7 +3975,7 @@ nm_setting_option_set(NMSetting *setting, const char *opt_name, GVariant *varian
g_hash_table_insert(hash, g_strdup(opt_name), g_variant_ref_sink(variant));
if (changed_value)
_nm_setting_option_notify(setting, !changed_name);
_nm_setting_option_notify(setting, changed_name);
}
/**
@ -4012,7 +4012,7 @@ nm_setting_option_set_boolean(NMSetting *setting, const char *opt_name, gboolean
g_hash_table_insert(hash, g_strdup(opt_name), g_variant_ref_sink(g_variant_new_boolean(value)));
if (changed_value)
_nm_setting_option_notify(setting, !changed_name);
_nm_setting_option_notify(setting, changed_name);
}
/**
@ -4047,7 +4047,7 @@ nm_setting_option_set_uint32(NMSetting *setting, const char *opt_name, guint32 v
g_hash_table_insert(hash, g_strdup(opt_name), g_variant_ref_sink(g_variant_new_uint32(value)));
if (changed_value)
_nm_setting_option_notify(setting, !changed_name);
_nm_setting_option_notify(setting, changed_name);
}
/*****************************************************************************/