Mercurial > dovecot > core-2.2
changeset 21351:10034ed9ee46
lib-index: Fix checking if cache file becomes >4GB
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Wed, 21 Dec 2016 20:56:58 +0200 |
parents | c848870c9cd1 |
children | eb1ba71862e3 |
files | src/lib-index/mail-cache.c |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-cache.c Tue Dec 20 13:34:43 2016 +0200 +++ b/src/lib-index/mail-cache.c Wed Dec 21 20:56:58 2016 +0200 @@ -777,9 +777,13 @@ mail_cache_set_syscall_error(cache, "fstat()"); return -1; } + if (st.st_size > (uint32_t)-1) { + mail_cache_set_corrupted(cache, "Cache file too large"); + return -1; + } *offset = st.st_size; } - if (*offset > (uint32_t)-1 || (uint32_t)-1 - *offset < size) { + if ((uint32_t)-1 - *offset < size) { mail_cache_set_corrupted(cache, "Cache file too large"); return -1; }