From: Timo Sirainen Date: Thu, 2 Nov 2017 21:24:38 +0000 (+0200) Subject: lib: istream-jsonstr - Fix potential infinite loop if parent stream's max_buffer_size... X-Git-Tag: 2.3.0.rc1~591 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81a99eefdfda5781126617d47f8fd6da67bf5543;p=thirdparty%2Fdovecot%2Fcore.git lib: istream-jsonstr - Fix potential infinite loop if parent stream's max_buffer_size is tiny --- diff --git a/src/lib/istream-jsonstr.c b/src/lib/istream-jsonstr.c index fb5875ffa3..1e333b18cf 100644 --- a/src/lib/istream-jsonstr.c +++ b/src/lib/istream-jsonstr.c @@ -27,7 +27,11 @@ i_stream_jsonstr_read_parent(struct jsonstr_istream *jstream, size = i_stream_get_data_size(stream->parent); while (size < min_bytes) { ret = i_stream_read_memarea(stream->parent); - if (ret <= 0 && (ret != -2 || stream->skip == 0)) { + if (ret <= 0) { + if (ret == -2) { + /* tiny parent buffer size - shouldn't happen */ + return -2; + } stream->istream.stream_errno = stream->parent->stream_errno; stream->istream.eof = stream->parent->eof;