From e33ff085ea3f86e2a8289be75d3ed86b84e2182e Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 23 Nov 2009 11:41:29 -0500 Subject: [PATCH] lib-index: Replaced ext-header update assert with "index corrupted" error handling. --HG-- branch : HEAD --- src/lib-index/mail-index-sync-ext.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; -- 2.47.3