From: Timo Sirainen Date: Tue, 31 Mar 2020 08:37:39 +0000 (+0300) Subject: lib-index: Use cache record's exact size when checking if it should be flushed X-Git-Tag: 2.3.11.2~387 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e50e283069131f4fda7f3ee69ede14d8ed610b3d;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Use cache record's exact size when checking if it should be flushed The field_idx wasn't included in the calculation. --- diff --git a/src/lib-index/mail-cache-transaction.c b/src/lib-index/mail-cache-transaction.c index 7e1457fd6a..efad489a51 100644 --- a/src/lib-index/mail-cache-transaction.c +++ b/src/lib-index/mail-cache-transaction.c @@ -737,7 +737,7 @@ void mail_cache_add(struct mail_cache_transaction_ctx *ctx, uint32_t seq, buffer_write(ctx->view->cached_exists_buf, field_idx, &ctx->view->cached_exists_value, 1); - full_size = (data_size + 3) & ~3; + full_size = sizeof(field_idx) + ((data_size + 3) & ~3); if (fixed_size == UINT_MAX) full_size += sizeof(data_size32);