]> granicus.if.org Git - neomutt/commitdiff
Selectively cache headers
authorRichard Russon <rich@flatcap.org>
Mon, 9 Jul 2018 14:26:26 +0000 (15:26 +0100)
committerRichard Russon <rich@flatcap.org>
Mon, 9 Jul 2018 14:26:26 +0000 (15:26 +0100)
Co-authored-by: JerikoOne <jeriko.one@gmx.us>
imap/util.c

index 614d87a5612d6769d9fdc27eb4d9557921842600..58224fc38725fa30e0bf3579ea24ad43c2e477c5 100644 (file)
@@ -245,6 +245,12 @@ header_cache_t *imap_hcache_open(struct ImapData *idata, const char *path)
     FREE(&mx.mbox);
   }
 
+  if (strstr(mbox, "/../") || (strcmp(mbox, "..") == 0) || (strncmp(mbox, "../", 3) == 0))
+    return NULL;
+  size_t len = strlen(mbox);
+  if ((len > 3) && (strcmp(mbox + len - 3, "/..") == 0))
+    return NULL;
+
   mutt_account_tourl(&idata->conn->account, &url);
   url.path = mbox;
   url_tostring(&url, cachepath, sizeof(cachepath), U_PATH);