From d5028c94aa6dcafb416bed60541cfad8af0fa277 Mon Sep 17 00:00:00 2001 From: Mehdi Abaakouk Date: Wed, 14 Nov 2018 10:07:37 +0100 Subject: [PATCH] imap: remove imap_parse_path2() from imap_hcache_open() --- imap/util.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/imap/util.c b/imap/util.c index 55a363c2a..a529d42e8 100644 --- a/imap/util.c +++ b/imap/util.c @@ -381,18 +381,16 @@ header_cache_t *imap_hcache_open(struct ImapAccountData *adata, const char *path struct Url url; char cachepath[PATH_MAX]; char mbox[PATH_MAX]; - char buf[PATH_MAX]; if (path) imap_cachepath(adata, path, mbox, sizeof(mbox)); - else + else if (adata->mailbox) { - if (!adata->mailbox || - imap_parse_path2(adata->mailbox->path, NULL, buf, sizeof(buf)) < 0) - return NULL; - - imap_cachepath(adata, buf, mbox, sizeof(mbox)); + struct ImapMailboxData *mdata = imap_mdata_get(adata->mailbox); + imap_cachepath(adata, mdata->name, mbox, sizeof(mbox)); } + else + return NULL; if (strstr(mbox, "/../") || (strcmp(mbox, "..") == 0) || (strncmp(mbox, "../", 3) == 0)) return NULL; -- 2.40.0