dovecot-2.2: lib-index: mail_transaction_log_file_map() didn't p...

dovecot at dovecot.org dovecot at dovecot.org
Fri Dec 4 09:38:15 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/a47d273e144f
changeset: 19457:a47d273e144f
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Dec 04 11:38:00 2015 +0200
description:
lib-index: mail_transaction_log_file_map() didn't properly check start_offset
If it was too high, it still returned successful mapping. This could have
caused an assert-crash later on when the start_offset was actually attempted
to be used.

diffstat:

 src/lib-index/mail-transaction-log-file.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 342e453c192d -r a47d273e144f src/lib-index/mail-transaction-log-file.c
--- a/src/lib-index/mail-transaction-log-file.c	Fri Dec 04 10:52:52 2015 +0200
+++ b/src/lib-index/mail-transaction-log-file.c	Fri Dec 04 11:38:00 2015 +0200
@@ -1681,6 +1681,7 @@
 				  uoff_t start_offset, uoff_t end_offset)
 {
 	struct mail_index *index = file->log->index;
+	uoff_t map_start_offset = start_offset;
 	size_t size;
 	int ret;
 
@@ -1736,14 +1737,14 @@
 		/* although we could just skip over the unwanted data, we have
 		   to sync everything so that modseqs are calculated
 		   correctly */
-		start_offset = file->sync_offset;
+		map_start_offset = file->sync_offset;
 	}
 
 	if ((file->log->index->flags & MAIL_INDEX_OPEN_FLAG_MMAP_DISABLE) == 0)
-		ret = mail_transaction_log_file_map_mmap(file, start_offset);
+		ret = mail_transaction_log_file_map_mmap(file, map_start_offset);
 	else {
 		mail_transaction_log_file_munmap(file);
-		ret = mail_transaction_log_file_read(file, start_offset, FALSE);
+		ret = mail_transaction_log_file_read(file, map_start_offset, FALSE);
 	}
 
 	i_assert(file->buffer == NULL || file->mmap_base != NULL ||


More information about the dovecot-cvs mailing list