From: Timo Sirainen Date: Mon, 7 Dec 2020 11:09:50 +0000 (+0200) Subject: lib-dcrypt: istream-decrypt - Assert that max_buffer_size > 0 X-Git-Tag: 2.3.14.rc1~227 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8b40060bf37b356bbe22c6cddbf8a0313c2364a5;p=thirdparty%2Fdovecot%2Fcore.git lib-dcrypt: istream-decrypt - Assert that max_buffer_size > 0 Otherwise all reads return -2, which will just result in assert-crash in i_stream_read(). --- diff --git a/src/lib-dcrypt/istream-decrypt.c b/src/lib-dcrypt/istream-decrypt.c index ffa3513340..0956fdc15f 100644 --- a/src/lib-dcrypt/istream-decrypt.c +++ b/src/lib-dcrypt/istream-decrypt.c @@ -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;