From: Timo Sirainen Date: Mon, 5 Apr 2010 05:59:04 +0000 (+0300) Subject: lib-storage: Avoid crash with pointless configs. X-Git-Tag: 2.0.beta5~204 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2a6dcd984104fed84bed8795ccdfabb20e41ce52;p=thirdparty%2Fdovecot%2Fcore.git lib-storage: Avoid crash with pointless configs. --HG-- branch : HEAD --- diff --git a/src/lib-storage/mailbox-list.c b/src/lib-storage/mailbox-list.c index 0b3c589335..cfe9eece5d 100644 --- a/src/lib-storage/mailbox-list.c +++ b/src/lib-storage/mailbox-list.c @@ -151,13 +151,15 @@ int mailbox_list_create(const char *driver, struct mail_namespace *ns, list->changelog_timestamp = (time_t)-1; /* copy settings */ - list->set.root_dir = p_strdup(list->pool, set->root_dir); - list->set.index_dir = set->index_dir == NULL || - strcmp(set->index_dir, set->root_dir) == 0 ? NULL : - p_strdup(list->pool, set->index_dir); - list->set.control_dir = set->control_dir == NULL || - strcmp(set->control_dir, set->root_dir) == 0 ? NULL : - p_strdup(list->pool, set->control_dir); + if (set->root_dir != NULL) { + list->set.root_dir = p_strdup(list->pool, set->root_dir); + list->set.index_dir = set->index_dir == NULL || + strcmp(set->index_dir, set->root_dir) == 0 ? NULL : + p_strdup(list->pool, set->index_dir); + list->set.control_dir = set->control_dir == NULL || + strcmp(set->control_dir, set->root_dir) == 0 ? NULL : + p_strdup(list->pool, set->control_dir); + } list->set.inbox_path = p_strdup(list->pool, set->inbox_path); list->set.subscription_fname =