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

dovecot at dovecot.org dovecot at dovecot.org
Wed May 13 19:47:18 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.1/rev/eb411eb1d9f2
changeset: 8267:eb411eb1d9f2
user:      Timo Sirainen <tss at iki.fi>
date:      Wed May 13 12:47:13 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 a5c3f5ea8732 -r eb411eb1d9f2 src/lib-storage/index/mbox/mbox-sync.c
--- a/src/lib-storage/index/mbox/mbox-sync.c	Wed May 13 12:41:55 2009 -0400
+++ b/src/lib-storage/index/mbox/mbox-sync.c	Wed May 13 12:47:13 2009 -0400
@@ -1301,6 +1301,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