dovecot-2.0: mbox: If mbox parsing notices unexpected corruption...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Dec 10 03:07:01 EET 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/b15a3277d7d4
changeset: 10446:b15a3277d7d4
user: Timo Sirainen <tss at iki.fi>
date: Wed Dec 09 20:06:20 2009 -0500
description:
mbox: If mbox parsing notices unexpected corruption, don't assert-crash.
diffstat:
1 file changed, 8 insertions(+), 6 deletions(-)
src/lib-storage/index/mbox/mbox-sync.c | 14 ++++++++------
diffs (32 lines):
diff -r 576abd71121c -r b15a3277d7d4 src/lib-storage/index/mbox/mbox-sync.c
--- a/src/lib-storage/index/mbox/mbox-sync.c Wed Dec 09 20:03:33 2009 -0500
+++ b/src/lib-storage/index/mbox/mbox-sync.c Wed Dec 09 20:06:20 2009 -0500
@@ -149,6 +149,9 @@ mbox_sync_read_next_mail(struct mbox_syn
mbox_sync_parse_next_mail(sync_ctx->input, mail_ctx);
i_assert(sync_ctx->input->v_offset != mail_ctx->mail.from_offset ||
sync_ctx->input->eof);
+
+ if (istream_raw_mbox_is_corrupted(sync_ctx->input))
+ return -1;
mail_ctx->mail.body_size =
istream_raw_mbox_get_body_size(sync_ctx->input,
@@ -1167,13 +1170,12 @@ static int mbox_sync_loop(struct mbox_sy
ret = mbox_sync_partial_seek_next(sync_ctx, uid + 1,
&partial,
&skipped_mails);
- if (ret <= 0) {
- if (ret < 0)
- return -1;
+ if (ret <= 0)
break;
- }
- }
- }
+ }
+ }
+ if (ret < 0)
+ return -1;
if (istream_raw_mbox_is_eof(sync_ctx->input)) {
/* rest of the messages in index don't exist -> expunge them */
More information about the dovecot-cvs
mailing list