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

dovecot at dovecot.org dovecot at dovecot.org
Wed Apr 4 03:45:00 EEST 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/47526bf86c57
changeset: 14374:47526bf86c57
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 b43ae3805f5f -r 47526bf86c57 src/lib-index/mail-index-map.c
--- a/src/lib-index/mail-index-map.c	Tue Apr 03 05:58:29 2012 +0300
+++ 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