]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Use cache record's exact size when checking if it should be flushed
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 31 Mar 2020 08:37:39 +0000 (11:37 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 15 Apr 2020 09:41:43 +0000 (12:41 +0300)
The field_idx wasn't included in the calculation.

src/lib-index/mail-cache-transaction.c

index 7e1457fd6abd57c458893b469082416cd1ae2b44..efad489a519ff6ded5a6bb7ab5b9309cfb24d77c 100644 (file)
@@ -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);