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.
--- 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);