diff options
author | Vincent Untz <vuntz@gnome.org> | 2010-04-16 09:44:35 -0400 |
---|---|---|
committer | Vincent Untz <vuntz@gnome.org> | 2010-04-16 09:44:35 -0400 |
commit | 518f7071a7f3073a4eeae56e3c585f66968e159d (patch) | |
tree | 9672a6ab19fc3189df2e7eacc4f65fb2e07c8380 /gsettings | |
parent | 4ee461da835a26f19116c27429a7119c369d8ddd (diff) | |
download | gconf-518f7071a7f3073a4eeae56e3c585f66968e159d.tar.gz |
[gsettings] G_VARIANT_TYPE_HANDLE is a signed 32bit integer
Diffstat (limited to 'gsettings')
-rw-r--r-- | gsettings/gconfsettingsbackend.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/gsettings/gconfsettingsbackend.c b/gsettings/gconfsettingsbackend.c index c8359249..e76a3a37 100644 --- a/gsettings/gconfsettingsbackend.c +++ b/gsettings/gconfsettingsbackend.c @@ -338,7 +338,12 @@ gconf_settings_backend_simple_gconf_value_type_to_gvariant (GConfValue * variant = g_variant_new_uint64 (value); } else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_HANDLE)) - variant = g_variant_new_handle (gconf_value_get_int (gconf_value)); + { + int value = gconf_value_get_int (gconf_value); + if (value < 0) + return NULL; + variant = g_variant_new_handle (value); + } else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_DOUBLE)) variant = g_variant_new_double (gconf_value_get_float (gconf_value)); else if (g_variant_type_equal (expected_type, G_VARIANT_TYPE_STRING)) @@ -519,7 +524,9 @@ gconf_settings_backend_simple_gvariant_to_gconf_value (GVariant *value } else if (g_variant_type_equal (type, G_VARIANT_TYPE_HANDLE)) { - gint32 i = g_variant_get_handle (value); + guint32 i = g_variant_get_handle (value); + if (i > G_MAXINT) + return NULL; gconf_value = gconf_value_new (GCONF_VALUE_INT); gconf_value_set_int (gconf_value, i); } |