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

dovecot at dovecot.org dovecot at dovecot.org
Fri May 1 21:50:24 EEST 2009


details:   http://hg.dovecot.org/dovecot-2.0/rev/01c0d64e5f91
changeset: 9195:01c0d64e5f91
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 44bd81c9d11a -r 01c0d64e5f91 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
@@ -1303,6 +1303,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