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