dovecot-2.0: lib-index: Don't assert-crash with broken extension...

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 4 03:46:27 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.0/rev/a45cfc1971e8
changeset: 13080:a45cfc1971e8
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Apr 04 03:44:04 2012 +0300
description:
lib-index: Don't assert-crash with broken extension record intros in log.

diffstat:

 src/lib-index/mail-index-map.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r ff1364d4d528 -r a45cfc1971e8 src/lib-index/mail-index-map.c
--- a/src/lib-index/mail-index-map.c	Thu Mar 22 18:28:04 2012 +0200
+++ b/src/lib-index/mail-index-map.c	Wed Apr 04 03:44:04 2012 +0300
@@ -174,6 +174,12 @@
 		return -1;
 	}
 
+	if (ext_hdr->record_offset == 0) {
+		/* if we get here from extension introduction, record_offset=0
+		   and hdr->record_size hasn't been updated yet */
+		return 0;
+	}
+
 	if (ext_hdr->record_offset + ext_hdr->record_size > hdr->record_size) {
 		*error_r = t_strdup_printf("Record field points "
 					   "outside record size (%u+%u > %u)",
@@ -210,9 +216,7 @@
 		return -1;
 	}
 
-	/* if we get here from extension introduction, record_offset=0 and
-	   hdr->record_size hasn't been updated yet */
-	if (ext_hdr->record_offset != 0 && ext_hdr->record_size != 0) {
+	if (ext_hdr->record_size != 0) {
 		if (mail_index_map_ext_hdr_check_record(hdr, ext_hdr,
 							error_r) < 0)
 			return -1;


More information about the dovecot-cvs mailing list