1
0
mirror of https://github.com/irssi/irssi.git synced 2024-12-04 14:46:39 -05:00

Merge branch 'fix-gl-13' into 'security'

Fix use after free when channel is destroyed inbetween being synced

See merge request irssi/irssi!19
This commit is contained in:
Nei 2017-10-20 13:12:27 +00:00 committed by ailin-nemui
commit f4c8018cfb

View File

@ -119,21 +119,22 @@ static void query_remove_all(IRC_CHANNEL_REC *channel)
int n;
rec = channel->server->chanqueries;
if (rec == NULL) return;
/* remove channel from query lists */
for (n = 0; n < CHANNEL_QUERIES; n++)
rec->queries[n] = g_slist_remove(rec->queries[n], channel);
rec->current_queries = g_slist_remove(rec->current_queries, channel);
query_check(channel->server);
if (!channel->server->disconnected)
query_check(channel->server);
}
static void sig_channel_destroyed(IRC_CHANNEL_REC *channel)
{
g_return_if_fail(channel != NULL);
if (IS_IRC_CHANNEL(channel) && !channel->server->disconnected &&
!channel->synced)
if (IS_IRC_CHANNEL(channel))
query_remove_all(channel);
}