]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: istream - Avoid panic in snapshot() with nonpersistent buffers
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 1 Nov 2017 22:00:00 +0000 (00:00 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 3 Nov 2017 11:24:01 +0000 (13:24 +0200)
src/lib/istream.c

index 905914c4703ebc188d6c061500b4e4ef143fb151..2073e249444274f2c406b49119d61d354d1fe401 100644 (file)
@@ -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));
        }