[dovecot-cvs] dovecot/src/lib-index mail-index-sync-update.c, 1.103, 1.104 mail-index-transaction.c, 1.83, 1.84

tss at dovecot.org tss at dovecot.org
Sat Nov 25 22:12:13 UTC 2006


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv28831

Modified Files:
	mail-index-sync-update.c mail-index-transaction.c 
Log Message:
Don't break if extension record size isn't divisible with 32bit.



Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.103
retrieving revision 1.104
diff -u -d -r1.103 -r1.104
--- mail-index-sync-update.c	23 Jul 2006 21:41:38 -0000	1.103
+++ mail-index-sync-update.c	25 Nov 2006 22:12:11 -0000	1.104
@@ -597,7 +597,7 @@
 		unsigned int record_size;
 
 		if (ctx->cur_ext_id == (uint32_t)-1) {
-		mail_index_sync_set_corrupted(ctx,
+			mail_index_sync_set_corrupted(ctx,
 				"Extension record update update "
 				"without intro prefix");
 			ret = -1;
@@ -610,7 +610,8 @@
 		}
 
 		ext = array_idx(&ctx->view->map->extensions, ctx->cur_ext_id);
-		record_size = sizeof(*rec) + ext->record_size;
+		/* the record is padded to 32bits in the transaction log */
+		record_size = (sizeof(*rec) + ext->record_size + 3) & ~3;
 
 		rec = data;
 		end = CONST_PTR_OFFSET(data, hdr->size);

Index: mail-index-transaction.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-transaction.c,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- mail-index-transaction.c	15 Oct 2006 12:59:43 -0000	1.83
+++ mail-index-transaction.c	25 Nov 2006 22:12:11 -0000	1.84
@@ -124,6 +124,9 @@
 	void *p;
 	unsigned int idx;
 
+	/* records need to be 32bit aligned */
+	record_size = (record_size + 3) & ~3;
+
 	if (!array_is_created(array)) {
 		array_create(array, default_pool, sizeof(seq) + record_size,
 			     1024 / (sizeof(seq) + record_size));



More information about the dovecot-cvs mailing list