]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Fix potential hang/assert-crash when client sends too long line
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 29 Oct 2024 08:36:43 +0000 (10:36 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 29 Oct 2024 14:40:50 +0000 (14:40 +0000)
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)

src/imap/imap-client.c

index f9dbe1d55caf1c2d26b93d67f4a2bed0dc1076f8..b157971460c834bd881dafd34869f4968821ffeb 100644 (file)
@@ -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);