dovecot-2.2: iostream-ssl: Don't hang if ostream's max buffer si...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 10 22:05:47 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/0ff3c63eb183
changeset: 16270:0ff3c63eb183
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 10 22:05:36 2013 +0300
description:
iostream-ssl: Don't hang if ostream's max buffer size is set to 0.

diffstat:

 src/lib-ssl-iostream/ostream-openssl.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 5ce775d70c7d -r 0ff3c63eb183 src/lib-ssl-iostream/ostream-openssl.c
--- a/src/lib-ssl-iostream/ostream-openssl.c	Wed Apr 10 21:18:07 2013 +0300
+++ b/src/lib-ssl-iostream/ostream-openssl.c	Wed Apr 10 22:05:36 2013 +0300
@@ -47,8 +47,14 @@
 		skip_left -= iov[i].iov_len;
 	}
 
-	avail = sstream->ostream.max_buffer_size > sstream->buffer->used ?
-		sstream->ostream.max_buffer_size - sstream->buffer->used : 0;
+	if (sstream->ostream.max_buffer_size == 0) {
+		/* we're requeted to use whatever space is available in
+		   the buffer */
+		avail = buffer_get_size(sstream->buffer) - sstream->buffer->used;
+	} else {
+		avail = sstream->ostream.max_buffer_size > sstream->buffer->used ?
+			sstream->ostream.max_buffer_size - sstream->buffer->used : 0;
+	}
 	if (i < iov_count && skip_left > 0) {
 		size = I_MIN(iov[i].iov_len - skip_left, avail);
 		buffer_append(sstream->buffer,


More information about the dovecot-cvs mailing list