From 7f545db9770e5bf454545ce97900eaba30b77856 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Tue, 4 Dec 2018 12:38:11 +0100 Subject: Fix a stringop-truncation GCC warning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ``` minetest/src/filesys.cpp:312:10: warning: ‘char* strncpy(char*, const char*, size_t)’ specified bound 10000 equals destination size [-Wstringop-truncation] strncpy(argv_data[2], path.c_str(), 10000); ``` --- src/filesys.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/filesys.cpp b/src/filesys.cpp index dc34b6b56..f61b39b94 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -309,7 +309,7 @@ bool RecursiveDelete(const std::string &path) strcpy(argv_data[0], "/bin/rm"); #endif strcpy(argv_data[1], "-rf"); - strncpy(argv_data[2], path.c_str(), 10000); + strncpy(argv_data[2], path.c_str(), sizeof(argv_data[2]) - 1); char *argv[4]; argv[0] = argv_data[0]; argv[1] = argv_data[1]; -- cgit v1.2.3