Skip to content

Commit

Permalink
Fix a stringop-truncation GCC warning
Browse files Browse the repository at this point in the history
```
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 committed Dec 4, 2018
1 parent b753ec4 commit 6e22b20
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/filesys.cpp
Expand Up @@ -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];
Expand Down

0 comments on commit 6e22b20

Please sign in to comment.