dovecot-1.2: Don't crash if trying to reset an extension which h...

dovecot at dovecot.org dovecot at dovecot.org
Tue Sep 9 17:35:42 EEST 2008


details:   http://hg.dovecot.org/dovecot-1.2/rev/f6838eb4e0e6
changeset: 8180:f6838eb4e0e6
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Sep 09 17:35:39 2008 +0300
description:
Don't crash if trying to reset an extension which had a broken intro record.

diffstat:

1 file changed, 5 insertions(+), 1 deletion(-)
src/lib-index/mail-index-sync-ext.c |    6 +++++-

diffs (23 lines):

diff -r 414b6a5c35db -r f6838eb4e0e6 src/lib-index/mail-index-sync-ext.c
--- a/src/lib-index/mail-index-sync-ext.c	Tue Sep 09 11:46:18 2008 +0300
+++ b/src/lib-index/mail-index-sync-ext.c	Tue Sep 09 17:35:39 2008 +0300
@@ -464,7 +464,7 @@ int mail_index_sync_ext_intro(struct mai
 
 	/* default to ignoring the following extension updates in case this
 	   intro is corrupted */
-	ctx->cur_ext_map_idx = 0;
+	ctx->cur_ext_map_idx = (uint32_t)-2;
 	ctx->cur_ext_ignore = TRUE;
 
 	if (u->ext_id != (uint32_t)-1 &&
@@ -578,6 +578,10 @@ int mail_index_sync_ext_reset(struct mai
 			"Extension reset without intro prefix");
 		return -1;
 	}
+	if (ctx->cur_ext_map_idx == (uint32_t)-2 && ctx->cur_ext_ignore) {
+		/* previous extension intro was broken */
+		return -1;
+	}
 	/* since we're resetting the extension, don't check cur_ext_ignore */
 
 	/* a new index file will be created, so the old data won't be


More information about the dovecot-cvs mailing list