mirror of
https://github.com/irssi/irssi.git
synced 2026-08-08 19:30:15 +02:00
fe-dcc-chat: fix segfault in dcc_closed() when window already destroyed
During shutdown, query_destroy() fires before dcc_close(), leaving the DCC record pointing at a freed window. dcc_closed() then calls printformat() with NULL as the window item, which causes a NULL dereference in store_lineinfo_tmp() at textbuffer-formats.c:148. Fix by looking up the query window and passing its name string to printformat(), falling back to NULL which safely prints to the server window. Also removes dead code where sender was allocated but never used in the printformat call. Reproducer: /dcc chat <nick>, then /quit Tested against both a local server and irc.libera.chat.
This commit is contained in:
parent
43f1727ef9
commit
b61f546588
1 changed files with 8 additions and 3 deletions
|
|
@ -74,14 +74,19 @@ static void dcc_connected(CHAT_DCC_REC *dcc)
|
|||
|
||||
static void dcc_closed(CHAT_DCC_REC *dcc)
|
||||
{
|
||||
QUERY_REC *query;
|
||||
char *sender;
|
||||
|
||||
if (!IS_DCC_CHAT(dcc)) return;
|
||||
if (!IS_DCC_CHAT(dcc)) return;
|
||||
|
||||
|
||||
sender = g_strconcat("=", dcc->id, NULL);
|
||||
printformat(dcc->server, NULL, MSGLEVEL_DCC,
|
||||
IRCTXT_DCC_CHAT_DISCONNECTED, dcc->id);
|
||||
query = query_find((SERVER_REC *)dcc->server, sender);
|
||||
g_free(sender);
|
||||
|
||||
|
||||
printformat(dcc->server, query ? query->name : NULL, MSGLEVEL_DCC,
|
||||
IRCTXT_DCC_CHAT_DISCONNECTED, dcc->id);
|
||||
}
|
||||
|
||||
static void dcc_chat_msg(CHAT_DCC_REC *dcc, const char *msg)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue