]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Handle 0-sized dovecot.index.log record properly
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 8 Apr 2022 10:42:55 +0000 (13:42 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Thu, 14 Apr 2022 06:47:55 +0000 (09:47 +0300)
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

index 753cb65c769a1fb837097be6ef79d738cd6f3e21..18201692bf99e199ef3e07b9cc83603a2f550336 100644 (file)
@@ -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(