mirror of
https://git.jabber.space/devs/cproof.git
synced 2026-07-19 22:56:21 +00:00
message: fix possible segfault in _message_handler
This commit is contained in:
@@ -162,12 +162,12 @@ _message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* con
|
|||||||
// type according to RFC 6121
|
// type according to RFC 6121
|
||||||
const char* type = xmpp_stanza_get_type(stanza);
|
const char* type = xmpp_stanza_get_type(stanza);
|
||||||
|
|
||||||
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
|
if (type && g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
|
||||||
_handle_error(stanza);
|
_handle_error(stanza);
|
||||||
} else if (g_strcmp0(type, STANZA_TYPE_GROUPCHAT) == 0) {
|
} else if (type && g_strcmp0(type, STANZA_TYPE_GROUPCHAT) == 0) {
|
||||||
// XEP-0045: Multi-User Chat
|
// XEP-0045: Multi-User Chat
|
||||||
_handle_groupchat(stanza);
|
_handle_groupchat(stanza);
|
||||||
} else if (g_strcmp0(type, STANZA_TYPE_HEADLINE) == 0) {
|
} else if (type && g_strcmp0(type, STANZA_TYPE_HEADLINE) == 0) {
|
||||||
_handle_headline(stanza);
|
_handle_headline(stanza);
|
||||||
} else if (type == NULL || g_strcmp0(type, STANZA_TYPE_CHAT) != 0 || g_strcmp0(type, STANZA_TYPE_NORMAL) != 0) {
|
} else if (type == NULL || g_strcmp0(type, STANZA_TYPE_CHAT) != 0 || g_strcmp0(type, STANZA_TYPE_NORMAL) != 0) {
|
||||||
// type: chat, normal (==NULL)
|
// type: chat, normal (==NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user