From: Aki Tuomi Date: Mon, 12 Mar 2018 12:48:41 +0000 (+0200) Subject: lib-dcrypt: istream-decrypt - Read more if buffer is empty X-Git-Tag: 2.3.9~2147 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8c8d530a17e4b37e5fc9a5dfdd532bbb9811f895;p=thirdparty%2Fdovecot%2Fcore.git lib-dcrypt: istream-decrypt - Read more if buffer is empty If there is no more buffered data, try to decrypt more. - Fixes Panic: file istream.c: line 192 (i_stream_read): assertion failed: (!stream->blocking) - Fixes infinite loop when stream is not blocking --- diff --git a/src/lib-dcrypt/istream-decrypt.c b/src/lib-dcrypt/istream-decrypt.c index d9f27e0d55..4b0854dcb0 100644 --- a/src/lib-dcrypt/istream-decrypt.c +++ b/src/lib-dcrypt/istream-decrypt.c @@ -673,7 +673,8 @@ i_stream_decrypt_read(struct istream_private *stream) bytes = new_pos - stream->pos; stream->pos = new_pos; - return (ssize_t)bytes; + if (bytes > 0) + return (ssize_t)bytes; } if (dstream->finalized) { /* all data decrypted */