diff --git a/kitty/disk-cache.c b/kitty/disk-cache.c index 5c7f43edc..33d5ee0f3 100644 --- a/kitty/disk-cache.c +++ b/kitty/disk-cache.c @@ -85,7 +85,7 @@ static int open_cache_file_without_tmpfile(const char *cache_path) { int fd = -1; static const char *template = "%s/disk-cache-XXXXXXXXXXXX"; - size_t sz = strlen(cache_path) + sizeof(template); + const size_t sz = strlen(cache_path) + sizeof(template) + 4; FREE_AFTER_FUNCTION char *buf = calloc(1, sz); if (!buf) { errno = ENOMEM; return -1; } snprintf(buf, sz - 1, template, cache_path);