Skip to content

Commit

Permalink
sdbox: Failing after saved mails' UIDs were already assigned caused u…
Browse files Browse the repository at this point in the history
…nlink()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.
  • Loading branch information
sirainen committed Feb 1, 2016
1 parent 7ae6552 commit d1808f8
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/lib-storage/index/dbox-single/sdbox-file.c
Expand Up @@ -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)
Expand Down

0 comments on commit d1808f8

Please sign in to comment.