From: Timo Sirainen Date: Tue, 24 Feb 2009 21:55:11 +0000 (-0500) Subject: mail_index_map_ext_hdr_check(): Fixed a wrong check. X-Git-Tag: 1.2.beta2~55 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f46068919d4b3e1f36028c4182108c169f914019;p=thirdparty%2Fdovecot%2Fcore.git mail_index_map_ext_hdr_check(): Fixed a wrong check. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-index-map.c b/src/lib-index/mail-index-map.c index 20cd2b6e43..57725b5df5 100644 --- a/src/lib-index/mail-index-map.c +++ b/src/lib-index/mail-index-map.c @@ -169,7 +169,10 @@ int mail_index_map_ext_hdr_check(const struct mail_index_header *hdr, 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 @@ int mail_index_map_ext_hdr_check(const struct mail_index_header *hdr, "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 "