comparison mcabber/mcabber/xmpp_muc.c @ 2358:b010ffcae282

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 db8de1b464d3
children
comparison
equal deleted inserted replaced
2357:6aeb142c8f12 2358:b010ffcae282
477 scr_LogPrint(LPRINT_LOGNORM, "Strange MUC presence message"); 477 scr_LogPrint(LPRINT_LOGNORM, "Strange MUC presence message");
478 } else { 478 } else {
479 // Make sure this is a room (it can be a conversion user->room) 479 // Make sure this is a room (it can be a conversion user->room)
480 buddy_settype(room_elt->data, ROSTER_TYPE_ROOM); 480 buddy_settype(room_elt->data, ROSTER_TYPE_ROOM);
481 } 481 }
482
483 // We're not interested in presence from the bare room JID (used for MUC
484 // avatars, for example)
485 if (!rname || rname[0] == '\0')
486 return;
482 487
483 // Get room member's information 488 // Get room member's information
484 muc_get_item_info(from, xmldata, &mbrole, &mbaffil, &mbjid, &mbnick, 489 muc_get_item_info(from, xmldata, &mbrole, &mbaffil, &mbjid, &mbnick,
485 &actor, &reason); 490 &actor, &reason);
486 491
734 } 739 }
735 } 740 }
736 } 741 }
737 } 742 }
738 743
739 // Sanity check, shouldn't happen...
740 if (!rname)
741 return;
742
743 // Update room member status 744 // Update room member status
744 roster_setstatus(roomjid, rname, bpprio, ust, ustmsg, usttime, 745 roster_setstatus(roomjid, rname, bpprio, ust, ustmsg, usttime,
745 mbrole, mbaffil, mbjid); 746 mbrole, mbaffil, mbjid);
746 747
747 if (new_member && autowhois == autowhois_on) { 748 if (new_member && autowhois == autowhois_on) {