]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
maildir: Added extra asserts.
authorTimo Sirainen <tss@iki.fi>
Fri, 24 Sep 2010 16:02:08 +0000 (17:02 +0100)
committerTimo Sirainen <tss@iki.fi>
Fri, 24 Sep 2010 16:02:08 +0000 (17:02 +0100)
src/lib-storage/index/maildir/maildir-save.c
src/lib-storage/index/maildir/maildir-sync-index.c
src/lib-storage/index/maildir/maildir-sync.c

index eae063251379a37e706052fa6d74df882b884281..9bbee8498fb3841f2a08a3ce2feb0ed49998aed7 100644 (file)
@@ -76,6 +76,9 @@ static int maildir_file_move(struct maildir_save_context *ctx,
        struct mail_storage *storage = &ctx->mbox->storage->storage;
        const char *tmp_path, *new_path;
 
+       i_assert(*destname != '\0');
+       i_assert(*mf->tmp_name != '\0');
+
        /* if we have flags, we'll move it to cur/ directly, because files in
           new/ directory can't have flags. alternative would be to write it
           in new/ and set the flags dirty in index file, but in that case
index c7e4d440233ad523965cf87b44fc6da7d69a776b..bd62d1be5b75a3840e3b33649cd51d6ba4f9abdd 100644 (file)
@@ -120,6 +120,8 @@ static int maildir_sync_flags(struct maildir_mailbox *mbox, const char *path,
        fname++;
        dir = t_strdup_until(path, fname);
 
+       i_assert(*fname != '\0');
+
        /* get the current flags and keywords */
        maildir_filename_get_flags(ctx->keywords_sync_ctx,
                                   fname, &ctx->flags, &ctx->keywords);
index 64f245a2cb361989fd5609103bb36515d58fced4..f257958c52551b3ac7dcefdc05f4eb5d1ba1265a 100644 (file)
@@ -429,6 +429,8 @@ maildir_scan_dir(struct maildir_sync_context *ctx, bool new_dir, bool final)
 
                flags = 0;
                if (move_new) {
+                       i_assert(dp->d_name[0] != '\0');
+
                        str_truncate(src, 0);
                        str_truncate(dest, 0);
                        str_printfa(src, "%s/%s", ctx->new_dir, dp->d_name);