dovecot-2.0: maildir: Added extra asserts.
    dovecot at dovecot.org 
    dovecot at dovecot.org
       
    Fri Sep 24 19:03:25 EEST 2010
    
    
  
details:   http://hg.dovecot.org/dovecot-2.0/rev/c2d50bd35dc4
changeset: 12173:c2d50bd35dc4
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Sep 24 17:02:08 2010 +0100
description:
maildir: Added extra asserts.
diffstat:
 src/lib-storage/index/maildir/maildir-save.c       |  3 +++
 src/lib-storage/index/maildir/maildir-sync-index.c |  2 ++
 src/lib-storage/index/maildir/maildir-sync.c       |  2 ++
 3 files changed, 7 insertions(+), 0 deletions(-)
diffs (37 lines):
diff -r aa18316e271d -r c2d50bd35dc4 src/lib-storage/index/maildir/maildir-save.c
--- a/src/lib-storage/index/maildir/maildir-save.c	Fri Sep 24 16:59:44 2010 +0100
+++ b/src/lib-storage/index/maildir/maildir-save.c	Fri Sep 24 17:02:08 2010 +0100
@@ -76,6 +76,9 @@
 	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
diff -r aa18316e271d -r c2d50bd35dc4 src/lib-storage/index/maildir/maildir-sync-index.c
--- a/src/lib-storage/index/maildir/maildir-sync-index.c	Fri Sep 24 16:59:44 2010 +0100
+++ b/src/lib-storage/index/maildir/maildir-sync-index.c	Fri Sep 24 17:02:08 2010 +0100
@@ -120,6 +120,8 @@
 	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);
diff -r aa18316e271d -r c2d50bd35dc4 src/lib-storage/index/maildir/maildir-sync.c
--- a/src/lib-storage/index/maildir/maildir-sync.c	Fri Sep 24 16:59:44 2010 +0100
+++ b/src/lib-storage/index/maildir/maildir-sync.c	Fri Sep 24 17:02:08 2010 +0100
@@ -429,6 +429,8 @@
 
 		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);
    
    
More information about the dovecot-cvs
mailing list