Skip to content
Permalink
Browse files

Fix a stringop-truncation GCC warning

```
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);
```
  • Loading branch information...
Loïc Blot
Loïc Blot committed Dec 4, 2018
1 parent b753ec4 commit 6e22b2071275103b927c302e34320d18f86c04d6
Showing with 1 addition and 1 deletion.
  1. +1 −1 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];

0 comments on commit 6e22b20

Please sign in to comment.
You can’t perform that action at this time.