dovecot-1.1: cache file: If offset isn't 32bit aligned, assume i...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jul 27 05:40:14 EEST 2009


details:   http://hg.dovecot.org/dovecot-1.1/rev/f73f2ae1b416
changeset: 8331:f73f2ae1b416
user:      Timo Sirainen <tss at iki.fi>
date:      Sun Jul 26 22:40:02 2009 -0400
description:
cache file: If offset isn't 32bit aligned, assume it's corrupted.

diffstat:

1 file changed, 6 insertions(+)
src/lib-index/mail-cache-lookup.c |    6 ++++++

diffs (16 lines):

diff -r 9b66f1af796a -r f73f2ae1b416 src/lib-index/mail-cache-lookup.c
--- a/src/lib-index/mail-cache-lookup.c	Sun Jul 26 21:56:17 2009 -0400
+++ b/src/lib-index/mail-cache-lookup.c	Sun Jul 26 22:40:02 2009 -0400
@@ -16,6 +16,12 @@ int mail_cache_get_record(struct mail_ca
 	const struct mail_cache_record *rec;
 
 	i_assert(offset != 0);
+
+	if (offset % sizeof(uint32_t) != 0) {
+		/* records are always 32-bit aligned */
+		mail_cache_set_corrupted(cache, "invalid record offset");
+		return -1;
+	}
 
 	/* we don't know yet how large the record is, so just guess */
 	if (mail_cache_map(cache, offset, sizeof(*rec) + CACHE_PREFETCH) < 0)


More information about the dovecot-cvs mailing list