From 22dcfb3a6770e9893440f6a99bed3aaf16e083b8 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Wed, 23 Mar 2022 14:59:00 +0100 Subject: [PATCH] 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: d0192b698e68 ('libnm: add nm_setting_option_set(), nm_setting_option_get_boolean(), nm_setting_option_set_boolean()') Fixes: 150af44e1042 ('libnm: add nm_setting_option_get_uint32(), nm_setting_option_set_uint32()') --- src/libnm-core-impl/nm-setting.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libnm-core-impl/nm-setting.c b/src/libnm-core-impl/nm-setting.c index e65e75e736..35070baed1 100644 --- a/src/libnm-core-impl/nm-setting.c +++ b/src/libnm-core-impl/nm-setting.c @@ -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); } /*****************************************************************************/