From: Timo Sirainen Date: Wed, 1 Nov 2017 22:00:00 +0000 (+0200) Subject: lib: istream - Avoid panic in snapshot() with nonpersistent buffers X-Git-Tag: 2.3.0.rc1~589 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ba55ec8fdf79301bfce9838d773250cef9486178;p=thirdparty%2Fdovecot%2Fcore.git lib: istream - Avoid panic in snapshot() with nonpersistent buffers --- diff --git a/src/lib/istream.c b/src/lib/istream.c index 905914c470..2073e24944 100644 --- a/src/lib/istream.c +++ b/src/lib/istream.c @@ -210,6 +210,13 @@ i_stream_default_snapshot(struct istream_private *stream, return snapshot; } if (stream->parent == NULL) { + if (stream->nonpersistent_buffers) { + /* Assume that memarea would be used normally, but + now it's NULL because the buffer is empty and + empty buffers are freed. */ + i_assert(stream->skip == stream->pos); + return prev_snapshot; + } i_panic("%s is missing istream.snapshot() implementation", i_stream_get_name(&stream->istream)); }