From 85cef4e2d94a420deceeb896287e31d70a229c91 Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Sat, 12 Oct 2013 16:18:01 +0200 Subject: [PATCH] util: Fixed possible off-by-one issue when generating filename (as reported by LLVM / clang) --- util/setstyle.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/setstyle.c b/util/setstyle.c index 7f99b6ff..80b9e1d7 100644 --- a/util/setstyle.c +++ b/util/setstyle.c @@ -440,7 +440,7 @@ int main(int argc, char **argv) perror(file); 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? */ printf("%s: %s: style file not found or not a file\n", __progname, buf);