dovecot-1.1: mail_index_map_ext_hdr_check(): Fixed a wrong check.

dovecot at dovecot.org dovecot at dovecot.org
Tue Feb 24 23:55:35 EET 2009


details:   http://hg.dovecot.org/dovecot-1.1/rev/a9bfb7a78e95
changeset: 8172:a9bfb7a78e95
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 24 16:55:11 2009 -0500
description:
mail_index_map_ext_hdr_check(): Fixed a wrong check.

diffstat:

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

diffs (24 lines):

diff -r b9262c72f168 -r a9bfb7a78e95 src/lib-index/mail-index-map.c
--- a/src/lib-index/mail-index-map.c	Mon Feb 23 13:40:01 2009 -0500
+++ b/src/lib-index/mail-index-map.c	Tue Feb 24 16:55:11 2009 -0500
@@ -168,7 +168,10 @@ int mail_index_map_ext_hdr_check(const s
 		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,
@@ -183,8 +186,6 @@ int mail_index_map_ext_hdr_check(const s
 					   "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 "


More information about the dovecot-cvs mailing list