From: Timo Sirainen Date: Mon, 23 Nov 2009 16:41:29 +0000 (-0500) Subject: lib-index: Replaced ext-header update assert with "index corrupted" error handling. X-Git-Tag: 2.0.beta1~94 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e33ff085ea3f86e2a8289be75d3ed86b84e2182e;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Replaced ext-header update assert with "index corrupted" error handling. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-index-sync-ext.c b/src/lib-index/mail-index-sync-ext.c index 06d17f9e52..ebc6dcb2d6 100644 --- a/src/lib-index/mail-index-sync-ext.c +++ b/src/lib-index/mail-index-sync-ext.c @@ -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;