mirror of
https://github.com/profanity-im/profanity.git
synced 2024-11-03 19:37:16 -05:00
message: make _message_handler safer
This commit is contained in:
parent
11382a8bf3
commit
b1bd1ecca8
@ -226,6 +226,7 @@ _message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* con
|
|||||||
char* mybarejid = connection_get_barejid();
|
char* mybarejid = connection_get_barejid();
|
||||||
const char* const stanza_from = xmpp_stanza_get_from(stanza);
|
const char* const stanza_from = xmpp_stanza_get_from(stanza);
|
||||||
|
|
||||||
|
if (stanza_from) {
|
||||||
if (g_strcmp0(mybarejid, stanza_from) != 0) {
|
if (g_strcmp0(mybarejid, stanza_from) != 0) {
|
||||||
log_warning("Invalid carbon received, from: %s", stanza_from);
|
log_warning("Invalid carbon received, from: %s", stanza_from);
|
||||||
msg_stanza = NULL;
|
msg_stanza = NULL;
|
||||||
@ -234,6 +235,7 @@ _message_handler(xmpp_conn_t* const conn, xmpp_stanza_t* const stanza, void* con
|
|||||||
// returns NULL if it was a carbon that was invalid, so that we dont parse later
|
// returns NULL if it was a carbon that was invalid, so that we dont parse later
|
||||||
msg_stanza = _handle_carbons(carbons);
|
msg_stanza = _handle_carbons(carbons);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
free(mybarejid);
|
free(mybarejid);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user