2
0
mirror of https://github.com/msantos/xmppipe synced 2024-11-16 00:12:59 +00:00

chat: fix segfault when checking origin

strcmp(3) segfaulted when comparing the from address to NULL.

Checking messages originated from the output account only makes sense
with groupchat. Remove the check for type of "chat".
This commit is contained in:
Michael Santos 2018-12-29 08:34:27 -05:00
parent dbbf6e5f5e
commit a10b4bd84c

View File

@ -1071,9 +1071,7 @@ handle_message(xmpp_conn_t * const conn, xmpp_stanza_t * const stanza,
return 1;
/* Check if the message is from us */
if (XMPPIPE_STREQ(type,
state->opt & XMPPIPE_OPT_GROUPCHAT ? "groupchat" : "chat")
&& XMPPIPE_STREQ(from, state->mucjid))
if (XMPPIPE_STREQ(type, "groupchat") && XMPPIPE_STREQ(from, state->mucjid))
return 1;
child = xmpp_stanza_get_child_by_name(stanza, "body");