From d1808f883d0da0e9740616695618924e8278fce1 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Mon, 1 Feb 2016 22:48:22 +0200 Subject: [PATCH] sdbox: Failing after saved mails' UIDs were already assigned caused unlink()ing garbage Mainly with dsync when it fails, the transaction is still committed and mails are given UIDs. If the transaction commit still fails, it attempts to rollback the saved mails by unlink()ing them, but at that point the path pointed to an already freed memory. This caused unlink() errors with some garbage strings as the path (and hopefully no actually valid paths). The easiest way to reproduce this was to fill up the filesystem with dsync. --- src/lib-storage/index/dbox-single/sdbox-file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/lib-storage/index/dbox-single/sdbox-file.c b/src/lib-storage/index/dbox-single/sdbox-file.c index 4f998511b8..4cdaaf2aa7 100644 --- a/src/lib-storage/index/dbox-single/sdbox-file.c +++ b/src/lib-storage/index/dbox-single/sdbox-file.c @@ -24,6 +24,7 @@ static void sdbox_file_init_paths(struct sdbox_file *file, const char *fname) i_free(file->file.alt_path); file->file.primary_path = i_strdup_printf("%s/%s", mailbox_get_path(box), fname); + file->file.cur_path = file->file.primary_path; if (mailbox_get_path_to(box, MAILBOX_LIST_PATH_TYPE_ALT_MAILBOX, &alt_path) > 0)