]> 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)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Wed, 13 Apr 2022 08:53:05 +0000 (08:53 +0000)
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 b6abbde23ce0691218878bef08642e9cdbb2e49f..37f296b3c6427c37a7fdb6aa96b53f3d298169f3 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(