dovecot-2.0: cache file: If offset isn't 32bit aligned, assume i...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jul 27 05:40:20 EEST 2009
details: http://hg.dovecot.org/dovecot-2.0/rev/436d2bead41b
changeset: 9672:436d2bead41b
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 a5d87492c083 -r 436d2bead41b src/lib-index/mail-cache-lookup.c
--- a/src/lib-index/mail-cache-lookup.c Sun Jul 26 22:13:53 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