elm: use Dbus securely
authorShinwoo Kim <cinoo.kim@samsung.com>
Fri, 2 Feb 2018 10:11:18 +0000 (19:11 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Fri, 2 Feb 2018 10:11:18 +0000 (19:11 +0900)
The Efl.Access.Attribute is using key and value.
The value could be NULL. If the value is NULL, then following error occurs.

*error:
arguments to dbus_message_iter_append_basic() were incorrect,
assertion "_dbus_check_is_valid_utf8 (*string_p)" failed
in file ../../dbus/dbus-message.c line 2712.
This is normally a bug in some application using the D-Bus library.
Array or variant type requires that type string be written, but end_dict_entry
was written.
The overall signature expected here was 'a{ss}' and we are on byte 3 of that
signature.

Change-Id: I474362b3c364e7f97a88515c0c20d35c796c4c50

src/lib/elementary/efl_ui_widget.c

index e9f79d3..f9599d1 100644 (file)
@@ -6173,26 +6173,36 @@ _efl_ui_widget_efl_access_state_set_get(Eo *obj, Elm_Widget_Smart_Data *pd EINA_
 EOLIAN static Eina_List*
 _efl_ui_widget_efl_access_attributes_get(Eo *obj, Elm_Widget_Smart_Data *pd EINA_UNUSED)
 {
+   const char *type = NULL;
+   const char *style = NULL;
    Eina_List *attr_list = NULL;
+   Efl_Access_Attribute *attr = NULL;
 
    attr_list = efl_access_attributes_get(efl_super(obj, EFL_UI_WIDGET_CLASS));
 
    //Add type and style information in addition.
-   Efl_Access_Attribute *attr = NULL;
-   attr = calloc(1, sizeof(Efl_Access_Attribute));
-   if (attr)
+   type = elm_widget_type_get(obj);
+   if (type)
      {
-        attr->key = eina_stringshare_add("type");
-        attr->value = eina_stringshare_add(elm_widget_type_get(obj));
-        attr_list = eina_list_append(attr_list, attr);
+        attr = calloc(1, sizeof(Efl_Access_Attribute));
+        if (attr)
+          {
+             attr->key = eina_stringshare_add("type");
+             attr->value = eina_stringshare_add(type);
+             attr_list = eina_list_append(attr_list, attr);
+           }
      }
 
-   attr = calloc(1, sizeof(Efl_Access_Attribute));
-   if (attr)
+   style = elm_widget_style_get(obj);
+   if (style)
      {
-        attr->key = eina_stringshare_add("style");
-        attr->value = eina_stringshare_add(elm_widget_style_get(obj));
-        attr_list = eina_list_append(attr_list, attr);
+        attr = calloc(1, sizeof(Efl_Access_Attribute));
+        if (attr)
+          {
+             attr->key = eina_stringshare_add("style");
+             attr->value = eina_stringshare_add(style);
+             attr_list = eina_list_append(attr_list, attr);
+          }
      }
 
    return attr_list;
@@ -6252,15 +6262,22 @@ _elm_widget_item_efl_access_relationships_clear(Eo *obj EINA_UNUSED, Elm_Widget_
 EOLIAN static Eina_List *
 _elm_widget_item_efl_access_attributes_get(Eo *eo_item, Elm_Widget_Item_Data *pd  EINA_UNUSED)
 {
+   const char *style = NULL;
    Eina_List *attr_list = NULL;
-   attr_list = efl_access_attributes_get(efl_super(eo_item, ELM_WIDGET_ITEM_CLASS));
    Efl_Access_Attribute *attr = NULL;
-   attr = calloc(1, sizeof(Efl_Access_Attribute));
-   if (attr)
+
+   attr_list = efl_access_attributes_get(efl_super(eo_item, ELM_WIDGET_ITEM_CLASS));
+
+   style = elm_object_item_style_get(eo_item);
+   if (style)
      {
-        attr->key = eina_stringshare_add("style");
-        attr->value = eina_stringshare_add(elm_object_item_style_get(eo_item));
-        attr_list = eina_list_append(attr_list, attr);
+        attr = calloc(1, sizeof(Efl_Access_Attribute));
+        if (attr)
+          {
+             attr->key = eina_stringshare_add("style");
+             attr->value = eina_stringshare_add(style);
+             attr_list = eina_list_append(attr_list, attr);
+          }
      }
    return attr_list;
 }