X-Git-Url: https://git.llucax.com/software/mutt-debian.git/blobdiff_plain/19304f7c526fbe36ba0db2fb80bcaf3bd974d81d..fb28dd0c09a87384504b12e4c6cee5c8b7582df3:/hcache.c?ds=sidebyside diff --git a/hcache.c b/hcache.c index ece4ca9..8b14aef 100644 --- a/hcache.c +++ b/hcache.c @@ -836,7 +836,7 @@ static char* get_foldername(const char *folder) { * to ensure equivalent paths share the hcache */ if (stat (folder, &st) == 0) { - p = safe_malloc (_POSIX_PATH_MAX+1); + p = safe_malloc (PATH_MAX+1); if (!realpath (folder, p)) mutt_str_replace (&p, folder); } else @@ -940,7 +940,10 @@ mutt_hcache_delete(header_cache_t *h, const char *filename, static int hcache_open_gdbm (struct header_cache* h, const char* path) { - int pagesize = atoi(HeaderCachePageSize) ? atoi(HeaderCachePageSize) : 16384; + int pagesize; + + if (mutt_atoi (HeaderCachePageSize, &pagesize) < 0 || pagesize <= 0) + pagesize = 16384; h->db = gdbm_open((char *) path, pagesize, GDBM_WRCREAT, 00600, NULL); if (h->db) @@ -1008,7 +1011,10 @@ hcache_open_db4 (struct header_cache* h, const char* path) struct stat sb; int ret; u_int32_t createflags = DB_CREATE; - int pagesize = atoi (HeaderCachePageSize); + int pagesize; + + if (mutt_atoi (HeaderCachePageSize, &pagesize) < 0 || pagesize <= 0) + pagesize = 16384; snprintf (h->lockfile, _POSIX_PATH_MAX, "%s-lock-hack", path);