[dovecot-cvs] dovecot/src/lib-index mail-index-sync-update.c, 1.53, 1.54

cras at dovecot.org cras at dovecot.org
Sun Nov 7 20:45:00 EET 2004


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

Modified Files:
	mail-index-sync-update.c 
Log Message:
Added extra checks to avoid crashes with corrupted transaction log.



Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- mail-index-sync-update.c	6 Nov 2004 17:20:18 -0000	1.53
+++ mail-index-sync-update.c	7 Nov 2004 18:44:58 -0000	1.54
@@ -190,6 +190,13 @@
         struct mail_index_expunge_handler *expunge_handlers, *eh;
 	size_t i, expunge_handlers_count;
 
+	if (e->uid1 > e->uid2 || e->uid1 == 0) {
+		mail_transaction_log_view_set_corrupted(ctx->view->log_view,
+				"Invalid UID range in expunge (%u .. %u)",
+				e->uid1, e->uid2);
+		return -1;
+	}
+
 	if (!view->map->write_to_disk) {
 		/* expunges have to be atomic. so we'll have to copy
 		   the mapping, do the changes there and then finally
@@ -313,6 +320,13 @@
 	uint32_t i, idx, seq1, seq2;
 	int update_keywords;
 
+	if (u->uid1 > u->uid2 || u->uid1 == 0) {
+		mail_transaction_log_view_set_corrupted(ctx->view->log_view,
+				"Invalid UID range in flag update (%u .. %u)",
+				u->uid1, u->uid2);
+		return -1;
+	}
+
 	if (mail_index_lookup_uid_range(view, u->uid1, u->uid2,
 					&seq1, &seq2) < 0)
 		return -1;



More information about the dovecot-cvs mailing list