changeset 8776:3bd20d70b0d6 HEAD

mail_index_map_ext_hdr_check(): Fixed a wrong check.
author Timo Sirainen <tss@iki.fi>
date Tue, 24 Feb 2009 16:55:11 -0500
parents 98e1115cd8f0
children ff1d88068275
files src/lib-index/mail-index-map.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-map.c	Tue Feb 24 16:41:08 2009 -0500
+++ b/src/lib-index/mail-index-map.c	Tue Feb 24 16:55:11 2009 -0500
@@ -169,7 +169,10 @@
 		return -1;
 	}
 
-	if (ext_hdr->record_offset + ext_hdr->record_size > hdr->record_size) {
+	/* 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_offset + ext_hdr->record_size > hdr->record_size) {
 		*error_r = t_strdup_printf("Record field points "
 					   "outside record size (%u+%u > %u)",
 					   ext_hdr->record_offset,
@@ -184,8 +187,6 @@
 					   "not used", ext_hdr->record_align);
 		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 &&
 	    (hdr->record_size % ext_hdr->record_align) != 0) {
 		*error_r = t_strdup_printf("Record size not aligned by %u "