From: Timo Sirainen Date: Thu, 29 Oct 2020 10:55:21 +0000 (+0200) Subject: imap: Fix potential hang if client disconnects with pipelined ambiguous commands X-Git-Tag: 2.3.14.rc1~302 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6fad5cd6fc3cc2f3082960b31752907e4a82e7ac;p=thirdparty%2Fdovecot%2Fcore.git imap: Fix potential hang if client disconnects with pipelined ambiguous commands For example if client pipelines FETCH+LOGOUT commands and disconnects during a large FETCH output, the LOGOUT command is processed as waiting for unambiguity. This code path however doesn't detect a client disconnection, and input IO handler is removed so it can't detect it either. So the imap process hangs. --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index ca5db576b2..2c7681d6d6 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -1117,7 +1117,9 @@ void client_continue_pending_input(struct client *client) if (!ret) break; } - if (!client->input->closed && !client->output->closed) + if (client->input->closed || client->output->closed) + client_destroy(client, NULL); + else client_check_command_hangs(client); }