From e1bea35419d0851323fb9d90b6284ded0bae802c Mon Sep 17 00:00:00 2001 From: dequis Date: Thu, 8 Oct 2015 06:38:15 -0300 Subject: Fix use-after-free when leaving invited (temporary) channels Trac ticket 1229, https://bugs.bitlbee.org/bitlbee/ticket/1229 This one is complicated. See the trac ticket for details. Relevant commits: cc20520 6963230 664bac3 - second one fixed the same issue, third one reverted it, this one takes a different approach. --- irc_im.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'irc_im.c') diff --git a/irc_im.c b/irc_im.c index 46699747..2d569bbb 100644 --- a/irc_im.c +++ b/irc_im.c @@ -862,8 +862,11 @@ static gboolean bee_irc_channel_chat_part(irc_channel_t *ic, const char *msg) c->ic->acc->prpl->chat_leave(c); } - /* Remove the reference. We don't need it anymore. */ - ic->data = NULL; + if (!(ic->flags & IRC_CHANNEL_TEMP)) { + /* Remove the reference. + * We only need it for temp channels that are being freed */ + ic->data = NULL; + } return TRUE; } -- cgit v1.2.3