From 35111acf4f63ef944ac25c1f0c2eb5c2c5b0161e Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 24 Feb 2009 16:55:11 -0500 Subject: [PATCH] mail_index_map_ext_hdr_check(): Fixed a wrong check. --HG-- branch : HEAD --- src/lib-index/mail-index-map.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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 " -- 2.47.3