From: Timo Sirainen Date: Wed, 20 Oct 2010 17:49:07 +0000 (+0100) Subject: istream-concat: Avoid assert-crashing. X-Git-Tag: 2.0.6~15 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=64055bc6d2ed9e25b3b1db3b5b90d0bdb77cd715;p=thirdparty%2Fdovecot%2Fcore.git istream-concat: Avoid assert-crashing. --- diff --git a/src/lib/istream-concat.c b/src/lib/istream-concat.c index 40a0c71aec..49bafa279c 100644 --- a/src/lib/istream-concat.c +++ b/src/lib/istream-concat.c @@ -70,9 +70,12 @@ static void i_stream_concat_read_next(struct concat_istream *cstream) /* we already verified that the data size is less than the maximum buffer size */ cstream->istream.pos = 0; - if (!i_stream_get_buffer_space(&cstream->istream, data_size, &size)) - i_unreached(); - i_assert(size >= data_size); + if (data_size > 0) { + if (!i_stream_get_buffer_space(&cstream->istream, + data_size, &size)) + i_unreached(); + i_assert(size >= data_size); + } cstream->prev_stream_left = data_size; memcpy(cstream->istream.w_buffer, data, data_size);