From: Timo Sirainen Date: Tue, 29 Oct 2024 09:22:27 +0000 (+0200) Subject: imap: Fix potential hang when client sends too long line X-Git-Tag: 2.4.0~1426 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=72a5ef3a1b60dacbb24a65bc1f01ec98efda3e7d;p=thirdparty%2Fdovecot%2Fcore.git imap: Fix potential hang when client sends too long line --- diff --git a/src/imap/imap-client.c b/src/imap/imap-client.c index b157971460..be0a490ffb 100644 --- a/src/imap/imap-client.c +++ b/src/imap/imap-client.c @@ -1190,6 +1190,13 @@ static bool client_skip_line(struct client *client) } i_stream_skip(client->input, i); + if (i > 0) { + /* We can be here if an earlier i_stream_read() has returned -2. + If there are multiple istreams layers, there might already + be input buffered in the istream. Make sure we finish + emptying the istream buffers so we don't hang. */ + i_stream_set_input_pending(client->input, TRUE); + } return !client->input_skip_line; }