diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | backends/xml-entry.c | 2 | ||||
-rw-r--r-- | gconf/gconf-internals.c | 53 | ||||
-rw-r--r-- | gconf/gconfd.c | 1 |
4 files changed, 41 insertions, 25 deletions
@@ -1,3 +1,13 @@ +2000-01-14 Havoc Pennington <hp@pobox.com> + + * gconf/gconfd.c (gconfd_all_entries): remove bad assertion that + the value in an entry was non-NULL + + * gconf/gconf.c (gconf_set): check for invalid list type + + * gconf/gconf-internals.c (gconf_value_from_corba_value): Be more + paranoid about list types coming from gconfd + 2000-01-13 Havoc Pennington <hp@pobox.com> * gconf/gconf.c (gconf_unique_key): function to generate diff --git a/backends/xml-entry.c b/backends/xml-entry.c index 5326db2a..be6c2f0f 100644 --- a/backends/xml-entry.c +++ b/backends/xml-entry.c @@ -523,7 +523,7 @@ node_set_value(xmlNodePtr node, GConfValue* value) free_childs(node); my_xmlSetProp(node, "ltype", - gconf_value_type_to_string(gconf_value_list_type(value))); + gconf_value_type_to_string(gconf_value_list_type(value))); /* Add a new child for each node */ list = gconf_value_list(value); diff --git a/gconf/gconf-internals.c b/gconf/gconf-internals.c index 613b24bc..90571c29 100644 --- a/gconf/gconf-internals.c +++ b/gconf/gconf-internals.c @@ -245,31 +245,38 @@ gconf_value_from_corba_value(const ConfigValue* value) break; } - i = 0; - while (i < value->_u.list_value.seq._length) + if (gconf_value_list_type(gval) != GCONF_VALUE_INVALID) { - GConfValue* val; - - /* This is a bit dubious; we cast a ConfigBasicValue to ConfigValue - because they have the same initial members, but by the time - the CORBA and C specs kick in, not sure we are guaranteed - to be able to do this. - */ - val = gconf_value_from_corba_value((ConfigValue*)&value->_u.list_value.seq._buffer[i]); - - if (val == NULL) - gconf_log(GCL_ERR, _("Couldn't interpret CORBA value for list element")); - else if (val->type != gconf_value_list_type(gval)) - gconf_log(GCL_ERR, _("Incorrect type for list element in %s"), __FUNCTION__); - else - list = g_slist_prepend(list, val); - - ++i; - } + i = 0; + while (i < value->_u.list_value.seq._length) + { + GConfValue* val; + + /* This is a bit dubious; we cast a ConfigBasicValue to ConfigValue + because they have the same initial members, but by the time + the CORBA and C specs kick in, not sure we are guaranteed + to be able to do this. + */ + val = gconf_value_from_corba_value((ConfigValue*)&value->_u.list_value.seq._buffer[i]); + + if (val == NULL) + gconf_log(GCL_ERR, _("Couldn't interpret CORBA value for list element")); + else if (val->type != gconf_value_list_type(gval)) + gconf_log(GCL_ERR, _("Incorrect type for list element in %s"), __FUNCTION__); + else + list = g_slist_prepend(list, val); + + ++i; + } - list = g_slist_reverse(list); + list = g_slist_reverse(list); - gconf_value_set_list_nocopy(gval, list); + gconf_value_set_list_nocopy(gval, list); + } + else + { + gconf_log(GCL_ERR, _("Received list from gconfd with a bad list type")); + } } break; case GCONF_VALUE_PAIR: @@ -365,7 +372,7 @@ fill_corba_value_from_gconf_value(GConfValue* value, default: cv->_u.list_value.list_type = BInvalidVal; - g_warning("Invalid list type in %s", __FUNCTION__); + gconf_log(GCL_DEBUG, "Invalid list type in %s", __FUNCTION__); break; } diff --git a/gconf/gconfd.c b/gconf/gconfd.c index fdb8ee06..485715c9 100644 --- a/gconf/gconfd.c +++ b/gconf/gconfd.c @@ -654,7 +654,6 @@ gconfd_all_entries (PortableServer_Servant servant, g_assert(p != NULL); g_assert(p->key != NULL); - g_assert(p->value != NULL); (*keys)->_buffer[i] = CORBA_string_dup(p->key); fill_corba_value_from_gconf_value(p->value, &((*values)->_buffer[i])); |