]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: mailbox_create_missing_dir() - Fix handling NULL mailbox directory
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 13 Jul 2017 13:20:53 +0000 (16:20 +0300)
committerAki Tuomi <aki.tuomi@dovecot.fi>
Fri, 14 Jul 2017 05:40:13 +0000 (08:40 +0300)
It would have caused stat(NULL), which would have failed.
Broken by 7071a02a8413fb409ade1625f6a1763c7493b66b

src/lib-storage/mail-storage.c

index 75d9259126ea73264264873ea4f3632f97bbb170..fb20e3524977c86548b6b65f1edd8bb3f830f4ff 100644 (file)
@@ -2732,7 +2732,7 @@ int mailbox_create_missing_dir(struct mailbox *box,
        if (stat(dir, &st) == 0)
                return 0;
 
-       if (null_strcmp(dir, mail_dir) != 0 &&
+       if (null_strcmp(dir, mail_dir) != 0 && mail_dir != NULL &&
            stat(mail_dir, &st) < 0 && (errno == ENOENT || errno == ENOTDIR)) {
                /* Race condition - mail root directory doesn't exist
                   anymore either. We shouldn't create this directory