X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/44c01adf506b1087bff724dcb65b92a12b012836..b2cc1a00b2cc87b28ff4d9601545cbb06529d847:/bcache.c diff --git a/bcache.c b/bcache.c index 81538d2..b61a207 100644 --- a/bcache.c +++ b/bcache.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2006-7 Brendan Cully - * Copyright (C) 2006 Rocco Rutte + * Copyright (C) 2006, 2009 Rocco Rutte * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -42,6 +42,7 @@ static int bcache_path(ACCOUNT *account, const char *mailbox, char *dst, size_t dstlen) { char host[STRING]; + char path[_POSIX_PATH_MAX]; ciss_url_t url; int len; @@ -62,12 +63,14 @@ static int bcache_path(ACCOUNT *account, const char *mailbox, return -1; } - dprint (3, (debugfile, "bcache_path: URL: '%s'\n", host)); + mutt_encode_path (path, sizeof (path), NONULL (mailbox)); len = snprintf (dst, dstlen-1, "%s/%s%s%s", MessageCachedir, - host, NONULL(mailbox), - (mailbox && *mailbox && - mailbox[mutt_strlen(mailbox) - 1] == '/') ? "" : "/"); + host, path, + (*path && path[mutt_strlen (path) - 1] == '/') ? "" : "/"); + + dprint (3, (debugfile, "bcache_path: rc: %d, path: '%s'\n", len, dst)); + if (len < 0 || len >= dstlen-1) return -1;