Mercurial > dovecot > core-2.2
changeset 19457:a47d273e144f
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.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 04 Dec 2015 11:38:00 +0200 |
parents | 342e453c192d |
children | 0b81127e53da |
files | src/lib-index/mail-transaction-log-file.c |
diffstat | 1 files changed, 4 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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 ||