dovecot-1.2: lib-index: Replaced ext-header update assert with "...

dovecot at dovecot.org dovecot at dovecot.org
Mon Nov 23 18:44:55 EET 2009


details:   http://hg.dovecot.org/dovecot-1.2/rev/9a8eb4d68b04
changeset: 9486:9a8eb4d68b04
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Nov 23 11:41:29 2009 -0500
description:
lib-index: Replaced ext-header update assert with "index corrupted" error handling.

diffstat:

1 file changed, 5 insertions(+), 1 deletion(-)
src/lib-index/mail-index-sync-ext.c |    6 +++++-

diffs (16 lines):

diff -r eff8d8e3673f -r 9a8eb4d68b04 src/lib-index/mail-index-sync-ext.c
--- a/src/lib-index/mail-index-sync-ext.c	Mon Nov 23 11:16:35 2009 -0500
+++ b/src/lib-index/mail-index-sync-ext.c	Mon Nov 23 11:41:29 2009 -0500
@@ -622,7 +622,11 @@ int mail_index_sync_ext_hdr_update(struc
 		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;


More information about the dovecot-cvs mailing list