From cff40db7cdc8a0827c70e240791f9f6ea31d1f60 Mon Sep 17 00:00:00 2001 From: Jakub Adam Date: Wed, 28 Nov 2012 21:53:16 +0100 Subject: [PATCH] notify: fix segfault when we got presence of a buddy not in contact list Happens after we delete some contact, sipe still receives notifications when its status changes. Unsubscribe is to be implemented. --- src/core/sipe-notify.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/core/sipe-notify.c b/src/core/sipe-notify.c index a1b12916..92f0ab7e 100644 --- a/src/core/sipe-notify.c +++ b/src/core/sipe-notify.c @@ -506,6 +506,7 @@ static void process_incoming_notify_rlmi(struct sipe_core_private *sipe_private, unsigned len) { const char *uri; + struct sipe_buddy *sbuddy = NULL; sipe_xml *xn_categories; const sipe_xml *xn_category; const char *status = NULL; @@ -515,6 +516,15 @@ static void process_incoming_notify_rlmi(struct sipe_core_private *sipe_private, xn_categories = sipe_xml_parse(data, len); uri = sipe_xml_attribute(xn_categories, "uri"); /* with 'sip:' prefix */ + if (uri) { + sbuddy = g_hash_table_lookup(sipe_private->buddies, uri); + } + + if (!sbuddy) { + /* Got presence of a buddy not in our contact list, ignore. */ + sipe_xml_free(xn_categories); + return; + } for (xn_category = sipe_xml_child(xn_categories, "category"); xn_category ; -- 2.11.4.GIT