]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
mail_index_map_ext_hdr_check(): Fixed a wrong check.
authorTimo Sirainen <tss@iki.fi>
Tue, 24 Feb 2009 21:55:11 +0000 (16:55 -0500)
committerTimo Sirainen <tss@iki.fi>
Tue, 24 Feb 2009 21:55:11 +0000 (16:55 -0500)
--HG--
branch : HEAD

src/lib-index/mail-index-map.c

index 20cd2b6e43d90ac014149d679971f8aae2853d1a..57725b5df599a566dc02f28ff91ab8a5ce7bcf18 100644 (file)
@@ -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 "