dovecot-2.1: lib-index: MAIL_INDEX_OPEN_FLAG_SAVEONLY was buggy ...

dovecot at dovecot.org dovecot at dovecot.org
Tue Dec 18 22:07:46 EET 2012


details:   http://hg.dovecot.org/dovecot-2.1/rev/bded819417d9
changeset: 14855:bded819417d9
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Dec 18 22:07:36 2012 +0200
description:
lib-index: MAIL_INDEX_OPEN_FLAG_SAVEONLY was buggy when reading data near end of dovecot.index.cache.
We assumed that we read as much as we requested, even if the file was
smaller.

diffstat:

 src/lib-index/mail-cache.c |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r 2f848393f78e -r bded819417d9 src/lib-index/mail-cache.c
--- a/src/lib-index/mail-cache.c	Tue Dec 18 22:05:55 2012 +0200
+++ b/src/lib-index/mail-cache.c	Tue Dec 18 22:07:36 2012 +0200
@@ -346,11 +346,12 @@
 	buffer_set_used_size(cache->read_buf, ret);
 
 	cache->read_offset = offset;
-	cache->mmap_length = offset + size;
+	cache->mmap_length = offset + cache->read_buf->used;
 
 	*data_r = data;
 	hdr_data = offset == 0 ? *data_r : NULL;
-	return mail_cache_map_finish(cache, offset, size, hdr_data, TRUE);
+	return mail_cache_map_finish(cache, offset,
+				     cache->read_buf->used, hdr_data, TRUE);
 }
 
 int mail_cache_map(struct mail_cache *cache, size_t offset, size_t size,


More information about the dovecot-cvs mailing list