]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Fix potential assert-crash when reading cache
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 24 Oct 2016 09:25:48 +0000 (12:25 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 24 Oct 2016 11:26:18 +0000 (14:26 +0300)
Fixes:
Panic: file mail-cache-lookup.c: line 258 (mail_cache_lookup_iter_next): assertion failed: (ctx->offset != 0)

Broken by d33fc6c584718efd46159e1d8f46488b9dfc66f5

src/lib-index/mail-cache-lookup.c

index 0f83198dc2a7195d67a78e95cbd2575e1b49886c..5acc59f97b06538c291c0e440c92b348325cd0ba 100644 (file)
@@ -199,7 +199,7 @@ mail_cache_lookup_iter_next_record(struct mail_cache_lookup_iterate_ctx *ctx)
                                return 1;
                        ctx->memory_appends_checked = TRUE;
                }
-               if (MAIL_CACHE_IS_UNUSABLE(view->cache))
+               if (MAIL_CACHE_IS_UNUSABLE(view->cache) || ctx->stop)
                        return 0;
 
                /* check data already written to cache file */