projects
/
oweals
/
minetest.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
39ea1cd
)
Fix a stringop-truncation GCC warning
author
Loïc Blot
<loic.blot@unix-experience.fr>
Tue, 4 Dec 2018 11:38:11 +0000
(12:38 +0100)
committer
Loïc Blot
<loic.blot@unix-experience.fr>
Tue, 4 Dec 2018 11:39:19 +0000
(12:39 +0100)
```
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
patch
|
blob
|
history
diff --git
a/src/filesys.cpp
b/src/filesys.cpp
index dc34b6b560798baaf795146d1a5ab261c3760099..f61b39b9465b191badf70befdb27da41e27b13f5 100644
(file)
--- 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];