dovecot-1.2: mbox: Don't crash when expunging all messages and f...

dovecot at dovecot.org dovecot at dovecot.org
Fri May 1 21:49:16 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/e87431fb8c90
changeset: 9005:e87431fb8c90
user:      Timo Sirainen <tss at iki.fi>
date:      Fri May 01 14:49:08 2009 -0400
description:
mbox: Don't crash when expunging all messages and file doesn't end with [CR]LF.

diffstat:

1 file changed, 6 insertions(+)
src/lib-storage/index/mbox/mbox-sync.c |    6 ++++++

diffs (16 lines):

diff -r d2d93c02dc7b -r e87431fb8c90 src/lib-storage/index/mbox/mbox-sync.c
--- a/src/lib-storage/index/mbox/mbox-sync.c	Fri May 01 13:15:30 2009 -0400
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Fri May 01 14:49:08 2009 -0400
@@ -1302,6 +1302,12 @@ static int mbox_sync_handle_eof_updates(
 			/* everything deleted, the trailer_size still contains
 			   the \n trailer though */
 			trailer_size = 0;
+		} else if (sync_ctx->expunged_space == (off_t)file_size + 1 ||
+			   sync_ctx->expunged_space == (off_t)file_size + 2) {
+			/* everything deleted and we didn't have a proper
+			   trailer. */
+			trailer_size = 0;
+			sync_ctx->expunged_space = file_size;
 		}
 
 		i_assert(file_size >= sync_ctx->expunged_space + trailer_size);


More information about the dovecot-cvs mailing list