diff options
author | dequis <dx@dxzone.com.ar> | 2015-04-03 22:23:59 -0300 |
---|---|---|
committer | dequis <dx@dxzone.com.ar> | 2015-04-03 22:23:59 -0300 |
commit | 4543b6bd3b333905bc22dd11cd2ffefd0ad04d27 (patch) | |
tree | b6df6408ee7ef8f3baaabc7675c2502db97921ab | |
parent | 3dcc878f69180d58b9a42768d7ef5ac9c542e4fa (diff) |
jabber: Fixed null deref when receiving <subject> from oneself
If the from="..." of the message that includes a subject refers to us,
that buddy object won't have an ext_jid set, and passing that to
strchr() results in pain.
This happens with recent versions of an xmpp server called "lets-chat".
-rw-r--r-- | protocols/jabber/conference.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/protocols/jabber/conference.c b/protocols/jabber/conference.c index 7435358a..bcf05b3c 100644 --- a/protocols/jabber/conference.c +++ b/protocols/jabber/conference.c @@ -358,7 +358,7 @@ void jabber_chat_pkt_message(struct im_connection *ic, struct jabber_buddy *bud, char *s; if (subject && chat) { - s = bud ? strchr(bud->ext_jid, '/') : NULL; + s = (bud && bud->ext_jid) ? strchr(bud->ext_jid, '/') : NULL; if (s) { *s = 0; } @@ -418,7 +418,7 @@ void jabber_chat_pkt_message(struct im_connection *ic, struct jabber_buddy *bud, return; } if (body && body->text_len > 0) { - s = strchr(bud->ext_jid, '/'); + s = (bud->ext_jid) ? strchr(bud->ext_jid, '/') : NULL; if (s) { *s = 0; } |