From 40e2a21f83fb11cd36e109b93d2b3fd704e3536e Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Fri, 8 Apr 2022 13:42:55 +0300 Subject: [PATCH] lib-index: Handle 0-sized dovecot.index.log record properly The previous behavior was to just silently ignore it and have the next write to the transaction log silently truncate away the trailing garbage. Now if the log file isn't locked the issue is still ignored, since it's possible that this is just a race condition. But if the log is locked, it's handled as corruption. --- src/lib-index/mail-transaction-log-file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib-index/mail-transaction-log-file.c b/src/lib-index/mail-transaction-log-file.c index 753cb65c76..18201692bf 100644 --- a/src/lib-index/mail-transaction-log-file.c +++ b/src/lib-index/mail-transaction-log-file.c @@ -1188,8 +1188,8 @@ mail_transaction_log_file_sync(struct mail_transaction_log_file *file, file->buffer_offset); trans_size = mail_index_offset_to_uint32(hdr->size); if (trans_size == 0) { - /* unfinished */ - return 1; + /* unfinished or corrupted */ + break; } if (trans_size < sizeof(*hdr)) { *reason_r = t_strdup_printf( -- 2.47.3