Skip to content

Commit

Permalink
fix call to snprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
phillbush committed Apr 4, 2023
1 parent b5df884 commit f671e8e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion xfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,13 +459,15 @@ initthumbnailer(struct FM *fm)
if ((str = getenv("CACHEDIR")) == NULL)
if ((str = getenv("XDG_CACHE_HOME")) == NULL)
return;
len = strlen(str);
if (PATH_MAX < len + 12) /* strlen("/thumbnails") + '\0' */
return;
mode = 0777 & ~umask(0);
dir_mode = mode | S_IWUSR | S_IXUSR;
(void)snprintf(path, PATH_MAX, "%s", str);
slash = strrchr(path, '\0');
while (--slash > path && *slash == '/')
*slash = '\0';
len = strlen(path);
(void)snprintf(path + len, PATH_MAX - len, "/thumbnails");
fm->thumbnaildir = estrdup(path);
slash = path;
Expand Down

0 comments on commit f671e8e

Please sign in to comment.