dovecot-2.2: lib-index: Minor code cleanup

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 15 01:42:02 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/0ecc40091784
changeset: 17148:0ecc40091784
user:      Timo Sirainen <tss at iki.fi>
date:      Sat Feb 15 10:41:29 2014 +0900
description:
lib-index: Minor code cleanup
The previous calculation was correct also though.

diffstat:

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

diffs (21 lines):

diff -r bc8822282f60 -r 0ecc40091784 src/lib-index/mail-cache-fields.c
--- a/src/lib-index/mail-cache-fields.c	Thu Feb 13 23:36:14 2014 +0200
+++ b/src/lib-index/mail-cache-fields.c	Sat Feb 15 10:41:29 2014 +0900
@@ -328,8 +328,7 @@
 
 	/* check the fixed size of the header. name[] has to be checked
 	   separately */
-	if (field_hdr->size < sizeof(*field_hdr) +
-	    field_hdr->fields_count * (sizeof(uint32_t)*2 + 1 + 2)) {
+	if (field_hdr->size < MAIL_CACHE_FIELD_NAMES(field_hdr->fields_count)) {
 		mail_cache_set_corrupted(cache, "invalid field header size");
 		return -1;
 	}
@@ -356,6 +355,7 @@
 	names = CONST_PTR_OFFSET(field_hdr,
 		MAIL_CACHE_FIELD_NAMES(field_hdr->fields_count));
 	end = CONST_PTR_OFFSET(field_hdr, field_hdr->size);
+	i_assert(names <= end);
 
 	/* clear the old mapping */
 	for (i = 0; i < cache->fields_count; i++)


More information about the dovecot-cvs mailing list