]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
imap: Fix panic on FETCH X-MAILBOX in virtual mailbox when mail is expunged
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 31 Jan 2017 19:03:29 +0000 (21:03 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 31 Jan 2017 19:16:20 +0000 (21:16 +0200)
src/imap/imap-fetch.c

index 4ca123c0603698d75264a79d1dff886bd84a26ab..b4aea80b8a492683b4425def74f1bc7c17e34c3c 100644 (file)
@@ -865,8 +865,11 @@ static int fetch_x_mailbox(struct imap_fetch_context *ctx, struct mail *mail,
        const char *name;
        string_t *mutf7_name;
 
-       if (mail_get_special(mail, MAIL_FETCH_MAILBOX_NAME, &name) < 0)
-               i_panic("mailbox name not returned");
+       if (mail_get_special(mail, MAIL_FETCH_MAILBOX_NAME, &name) < 0) {
+               /* This can happen with virtual mailbox if the backend mail
+                  is expunged. */
+               return -1;
+       }
 
        mutf7_name = t_str_new(strlen(name)*2);
        if (imap_utf8_to_utf7(name, mutf7_name) < 0)