Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9005:e87431fb8c90 HEAD
mbox: Don't crash when expunging all messages and file doesn't end with [CR]LF.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 01 May 2009 14:49:08 -0400 |
parents | d2d93c02dc7b |
children | 06bd1266f0c7 |
files | src/lib-storage/index/mbox/mbox-sync.c |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ /* 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);