]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
storage: do NOT feed p_strconcat() with NULL.
authorBaofeng <baofeng.wang@dovecot.com>
Tue, 12 Apr 2016 10:08:05 +0000 (13:08 +0300)
committerBaofeng Wang <baofeng.wang@dovecot.fi>
Fri, 3 Jun 2016 11:24:00 +0000 (14:24 +0300)
p_strconcat will never take NULL as an valid argument.
So ns->list->set.alt_dir has to be checked NULL.

src/lib-storage/index/dbox-multi/mdbox-storage.c

index b09a6bc25c4e0aa05807e93d2394145c83d758f9..a58bd736fb589d5ca7676614cb1708c57e4e2ed4 100644 (file)
@@ -53,9 +53,11 @@ int mdbox_storage_create(struct mail_storage *_storage,
        dir = mailbox_list_get_root_forced(ns->list, MAILBOX_LIST_PATH_TYPE_DIR);
        storage->storage_dir = p_strconcat(_storage->pool, dir,
                                           "/"MDBOX_GLOBAL_DIR_NAME, NULL);
-       storage->alt_storage_dir = p_strconcat(_storage->pool,
-                                              ns->list->set.alt_dir,
-                                              "/"MDBOX_GLOBAL_DIR_NAME, NULL);
+       if (ns->list->set.alt_dir != NULL) {
+               storage->alt_storage_dir = p_strconcat(_storage->pool,
+                                                       ns->list->set.alt_dir,
+                                                       "/"MDBOX_GLOBAL_DIR_NAME, NULL);
+       }
        i_array_init(&storage->open_files, 64);
 
        storage->map = mdbox_map_init(storage, ns->list);