Mercurial > dovecot > original-hg > dovecot-1.2
changeset 9259:ea2eed32d59e HEAD
cache file: If offset isn't 32bit aligned, assume it's corrupted.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 26 Jul 2009 22:40:02 -0400 |
parents | b36b0291e1c1 |
children | 1127a2fddffc |
files | src/lib-index/mail-cache-lookup.c |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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 @@ -17,6 +17,12 @@ 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) return -1;