From: Timo Sirainen Date: Tue, 29 Oct 2024 08:36:43 +0000 (+0200) Subject: imap: Fix potential hang/assert-crash when client sends too long line X-Git-Tag: 2.4.0~1428 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=06446b47de0ef2eac1bfa8ff248d79dbac30431b;p=thirdparty%2Fdovecot%2Fcore.git imap: Fix potential hang/assert-crash when client sends too long line If client sent some commands pipelined, followed by a command with too long line, the previous commands' tagged replies weren't sent. This caused it to hang until more input was received. After that it crashed. Fixes: Panic: file imap-client.c: line 1098 (client_check_command_hangs): assertion failed: (!have_wait_unfinished || unfinished_count > 0) --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index f9dbe1d55c..b157971460 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -1432,6 +1432,10 @@ void client_input(struct client *client) cmd->param_error = TRUE; client_send_command_error(cmd, "Too long argument."); client_command_free(&cmd); + + /* We may have delayed syncing previous commands to handle this + one. Do it now to avoid hanging. */ + (void)cmd_sync_delayed(client); } o_stream_uncork(output); o_stream_unref(&output);