1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-19 12:28:22 +01:00

util: Fixed possible off-by-one issue when generating filename

(as reported by LLVM / clang)
This commit is contained in:
Christophe CURIS
2013-10-12 16:18:01 +02:00
committed by Carlos R. Mafra
parent 5a16cb8e02
commit 85cef4e2d9

View File

@@ -440,7 +440,7 @@ int main(int argc, char **argv)
perror(file); perror(file);
return 1; return 1;
} }
strncat(buf, "/style", sizeof(buf) - strlen(buf)); strncat(buf, "/style", sizeof(buf) - strlen(buf) - 1);
if (stat(buf, &st) != 0 || !S_ISREG(st.st_mode)) { /* maybe symlink too? */ if (stat(buf, &st) != 0 || !S_ISREG(st.st_mode)) { /* maybe symlink too? */
printf("%s: %s: style file not found or not a file\n", __progname, buf); printf("%s: %s: style file not found or not a file\n", __progname, buf);