From e50e283069131f4fda7f3ee69ede14d8ed610b3d Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Tue, 31 Mar 2020 11:37:39 +0300 Subject: [PATCH] lib-index: Use cache record's exact size when checking if it should be flushed The field_idx wasn't included in the calculation. --- src/lib-index/mail-cache-transaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); -- 2.47.3