]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Fix potential hang when client sends too long line
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 29 Oct 2024 09:22:27 +0000 (11:22 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Tue, 29 Oct 2024 14:40:50 +0000 (14:40 +0000)
src/imap/imap-client.c

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