dovecot-2.1: lib-storage: Avoid crashes if listing subscriptions...

dovecot at dovecot.org dovecot at dovecot.org
Tue Dec 6 23:51:32 EET 2011


details:   http://hg.dovecot.org/dovecot-2.1/rev/85f33815c5e7
changeset: 13800:85f33815c5e7
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Dec 06 23:51:09 2011 +0200
description:
lib-storage: Avoid crashes if listing subscriptions for a namespace that can't have any.
i.e. the namespace and its parents all have subscriptions=no

diffstat:

 src/lib-storage/mailbox-list-iter.c |  7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diffs (17 lines):

diff -r 24fe54f2cfcb -r 85f33815c5e7 src/lib-storage/mailbox-list-iter.c
--- a/src/lib-storage/mailbox-list-iter.c	Tue Dec 06 23:35:58 2011 +0200
+++ b/src/lib-storage/mailbox-list-iter.c	Tue Dec 06 23:51:09 2011 +0200
@@ -61,7 +61,12 @@
 		ns = mail_namespace_find_subscribable(ns->user->namespaces,
 						      ns->prefix);
 		if (ns == NULL) {
-			/* no subscriptions */
+			/* no subscriptions. avoid crashes by initializing
+			   a subscriptions tree. */
+			if (list->subscriptions == NULL) {
+				char sep = mail_namespace_get_sep(list->ns);
+				list->subscriptions = mailbox_tree_init(sep);
+			}
 			return 0;
 		}
 	}


More information about the dovecot-cvs mailing list