]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Replaced ext-header update assert with "index corrupted" error handling.
authorTimo Sirainen <tss@iki.fi>
Mon, 23 Nov 2009 16:41:29 +0000 (11:41 -0500)
committerTimo Sirainen <tss@iki.fi>
Mon, 23 Nov 2009 16:41:29 +0000 (11:41 -0500)
--HG--
branch : HEAD

src/lib-index/mail-index-sync-ext.c

index 06d17f9e52427db0952e87d483cf3679e31449e4..ebc6dcb2d62dc760167989264ba4cd1b9b810339 100644 (file)
@@ -619,7 +619,11 @@ int mail_index_sync_ext_hdr_update(struct mail_index_sync_map_ctx *ctx,
                return 1;
 
        ext = array_idx(&map->extensions, ctx->cur_ext_map_idx);
-       i_assert(ext->hdr_offset + offset + size <= map->hdr.header_size);
+       if (ext->hdr_offset + offset + size > map->hdr.header_size) {
+               mail_index_sync_set_corrupted(ctx,
+                       "Extension header update points outside header size");
+               return -1;
+       }
 
        buffer_write(map->hdr_copy_buf, ext->hdr_offset + offset, data, size);
        map->hdr_base = map->hdr_copy_buf->data;