]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-dcrypt: istream-decrypt - Read more if buffer is empty
authorAki Tuomi <aki.tuomi@dovecot.fi>
Mon, 12 Mar 2018 12:48:41 +0000 (14:48 +0200)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Wed, 21 Mar 2018 07:11:19 +0000 (09:11 +0200)
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

src/lib-dcrypt/istream-decrypt.c

index d9f27e0d5577fcac0e530428ce474f4259a14f3f..4b0854dcb02d74bd6b6a89f1c1c74b889db0138a 100644 (file)
@@ -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 */