Skip to content

Commit

Permalink
imap: Fix potential hang/assert-crash when client sends too long line
Browse files Browse the repository at this point in the history
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)
  • Loading branch information
sirainen authored and cmouse committed Oct 29, 2024
1 parent d88bac2 commit 06446b4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/imap/imap-client.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 06446b4

Please sign in to comment.