message: fix possible segfault in _handle_conference
This commit is contained in:
@@ -931,6 +931,8 @@ _handle_conference(xmpp_stanza_t* const stanza)
|
|||||||
{
|
{
|
||||||
xmpp_stanza_t* xns_conference = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CONFERENCE);
|
xmpp_stanza_t* xns_conference = xmpp_stanza_get_child_by_ns(stanza, STANZA_NS_CONFERENCE);
|
||||||
|
|
||||||
|
if (xns_conference) {
|
||||||
|
|
||||||
const char* from = xmpp_stanza_get_from(stanza);
|
const char* from = xmpp_stanza_get_from(stanza);
|
||||||
if (!from) {
|
if (!from) {
|
||||||
log_warning("Message received with no from attribute, ignoring");
|
log_warning("Message received with no from attribute, ignoring");
|
||||||
@@ -949,12 +951,14 @@ _handle_conference(xmpp_stanza_t* const stanza)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// reason and password are both optional
|
||||||
const char* reason = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_REASON);
|
const char* reason = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_REASON);
|
||||||
const char* password = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_PASSWORD);
|
const char* password = xmpp_stanza_get_attribute(xns_conference, STANZA_ATTR_PASSWORD);
|
||||||
|
|
||||||
sv_ev_room_invite(INVITE_DIRECT, jidp->barejid, room, reason, password);
|
sv_ev_room_invite(INVITE_DIRECT, jidp->barejid, room, reason, password);
|
||||||
jid_destroy(jidp);
|
jid_destroy(jidp);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_handle_captcha(xmpp_stanza_t* const stanza)
|
_handle_captcha(xmpp_stanza_t* const stanza)
|
||||||
|
|||||||
Reference in New Issue
Block a user