]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: COMPRESS - Fail if client pipelines data without waiting for OK reply
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 3 May 2024 09:45:51 +0000 (12:45 +0300)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 18 Jun 2024 08:31:38 +0000 (08:31 +0000)
src/imap/cmd-compress.c

index 52c74b5a8214e159e512bdf4d6a29b2f61d035e5..0c3042cc290ce3d35c6927abdd29f7377ece2d63 100644 (file)
@@ -75,6 +75,14 @@ bool cmd_compress(struct client_command_context *cmd)
        }
 
        client_skip_line(client);
+
+       /* Client cannot assume that COMPRESS works and just start sending
+          compressed data pipelined. Add an explicit sanity check for this. */
+       if (i_stream_get_data_size(client->input) > 0) {
+               client_send_tagline(cmd, "BAD Client did not wait for COMPRESS reply before sending more data");
+               return TRUE;
+       }
+
        client_send_tagline(cmd, "OK Begin compression.");
 
        uoff_t prev_out_offset = client->output->offset;