]> 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>
Tue, 13 Mar 2018 08:23:36 +0000 (10:23 +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 ef294860684a79dd33b6352b88594f8c6e2ceffd..a2623f3a0615996c6d1fc19b81f59313b2245508 100644 (file)
@@ -671,7 +671,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 */