[telepathy-glib-0.18] telepathy-glib: fix segfault in got_contact_list_attributes_cb

Simon McVittie smcv at kemper.freedesktop.org
Mon Jan 7 05:04:20 PST 2013


Module: telepathy-glib
Branch: telepathy-glib-0.18
Commit: bc691e42d9e55ce6fe5030f898b8166b7e44d90b
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=bc691e42d9e55ce6fe5030f898b8166b7e44d90b

Author: Maksim Melnikau <maxposedon at gmail.com>
Date:   Sun Jan  6 02:01:00 2013 +0300

fix segfault in got_contact_list_attributes_cb

tp_simple_client_factory_ensure_contact returns NULL for protocols, if
tp_connection_has_immortal_handles=0. Right now its happened for any
telepathy-python based protocols (butterfly, sunsine, mixer).

when tp_simple_client_factory_ensure_contact returns NULL,
tp_simple_client_factory_ensure_contact just segfault in
_tp_contact_set_attributes.

lets assume that contact sometimes NULL here, and skip them

Signed-off-by: Maksim Melnikau <maxposedon at gmail.com>
[edited for coding style, added a comment -smcv]
Reviewed-by: Simon McVittie <simon.mcvittie at collabora.co.uk>

---

 telepathy-glib/connection-contact-list.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/telepathy-glib/connection-contact-list.c b/telepathy-glib/connection-contact-list.c
index ae6d089..b2efc25 100644
--- a/telepathy-glib/connection-contact-list.c
+++ b/telepathy-glib/connection-contact-list.c
@@ -259,6 +259,12 @@ got_contact_list_attributes_cb (TpConnection *self,
 
       contact = tp_simple_client_factory_ensure_contact (
           tp_proxy_get_factory (self), self, handle, id);
+
+      /* ensure_contact() can fail for obsolete CMs that don't have
+       * ImmortalHandles */
+      if (contact == NULL)
+         continue;
+
       if (!_tp_contact_set_attributes (contact, value,
               features->len, (TpContactFeature *) features->data, &e))
         {



More information about the telepathy-commits mailing list