changeset 2358:b010ffcae282 default tip

Don't crash on presence from bare room JID While handling MUC presence, check whether it was sent from the bare room JID before assuming a non-NULL resource name. These days, some servers send presence from the bare room JID to handle MUC avatars.
author Holger Weiß <holger@zedat.fu-berlin.de>
date Tue, 22 Oct 2019 19:59:21 +0200
parents 6aeb142c8f12
children
files mcabber/mcabber/xmpp_muc.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mcabber/mcabber/xmpp_muc.c	Sat Sep 19 16:43:00 2020 +0200
+++ b/mcabber/mcabber/xmpp_muc.c	Tue Oct 22 19:59:21 2019 +0200
@@ -480,6 +480,11 @@
     buddy_settype(room_elt->data, ROSTER_TYPE_ROOM);
   }
 
+  // We're not interested in presence from the bare room JID (used for MUC
+  // avatars, for example)
+  if (!rname || rname[0] == '\0')
+    return;
+
   // Get room member's information
   muc_get_item_info(from, xmldata, &mbrole, &mbaffil, &mbjid, &mbnick,
                     &actor, &reason);
@@ -736,10 +741,6 @@
     }
   }
 
-  // Sanity check, shouldn't happen...
-  if (!rname)
-    return;
-
   // Update room member status
   roster_setstatus(roomjid, rname, bpprio, ust, ustmsg, usttime,
                    mbrole, mbaffil, mbjid);