From 4543b6bd3b333905bc22dd11cd2ffefd0ad04d27 Mon Sep 17 00:00:00 2001 From: dequis Date: Fri, 3 Apr 2015 22:23:59 -0300 Subject: jabber: Fixed null deref when receiving 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". --- protocols/jabber/conference.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'protocols/jabber') 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; } -- cgit v1.2.3