mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
Don't crash if we get a message without from or type
MAM messages don't have a type nor a from. If we detect a message without type let's log it and exit without continuing to try to parse it. Otherwise we go into _handle_chat() and crash on the no from.
This commit is contained in:
parent
fe9b520c42
commit
e878b6d266
@ -99,13 +99,20 @@ _message_handler(xmpp_conn_t *const conn, xmpp_stanza_t *const stanza, void *con
|
||||
size_t text_size;
|
||||
xmpp_stanza_to_text(stanza, &text, &text_size);
|
||||
gboolean cont = plugins_on_message_stanza_receive(text);
|
||||
xmpp_free(connection_get_ctx(), text);
|
||||
if (!cont) {
|
||||
xmpp_free(connection_get_ctx(), text);
|
||||
return 1;
|
||||
}
|
||||
|
||||
const char *type = xmpp_stanza_get_type(stanza);
|
||||
|
||||
if (type == NULL) {
|
||||
log_info("Received <message> without 'type': %s", text);
|
||||
xmpp_free(connection_get_ctx(), text);
|
||||
return 1;
|
||||
}
|
||||
xmpp_free(connection_get_ctx(), text);
|
||||
|
||||
if (g_strcmp0(type, STANZA_TYPE_ERROR) == 0) {
|
||||
_handle_error(stanza);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user