]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dcrypt: istream-decrypt - Assert that max_buffer_size > 0
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Mon, 7 Dec 2020 11:09:50 +0000 (13:09 +0200)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Mon, 7 Dec 2020 12:30:36 +0000 (12:30 +0000)
Otherwise all reads return -2, which will just result in assert-crash in
i_stream_read().

src/lib-dcrypt/istream-decrypt.c

index ffa35133408035d357644c5c57d23270cd5f5cf6..0956fdc15f621dd33da434385b9778175da45e87 100644 (file)
@@ -999,6 +999,8 @@ i_stream_create_decrypt_common(struct istream *input)
 {
        struct decrypt_istream *dstream;
 
+       i_assert(input->real_stream->max_buffer_size > 0);
+
        dstream = i_new(struct decrypt_istream, 1);
        dstream->istream.max_buffer_size = input->real_stream->max_buffer_size;
        dstream->istream.read = i_stream_decrypt_read;