[Cmake-commits] CMake branch, next, updated. v3.6.1-1447-gd89838e
Brad King
brad.king at kitware.com
Thu Aug 25 10:59:45 EDT 2016
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via d89838e180cf2d1f6aab2c403135d599c775e9af (commit)
via cd344e3a62e3a6728e5b749cb923104c2c09949c (commit)
from 7ea8c85db1c15f2fec85203a6807c6f06555716e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d89838e180cf2d1f6aab2c403135d599c775e9af
commit d89838e180cf2d1f6aab2c403135d599c775e9af
Merge: 7ea8c85 cd344e3
Author: Brad King <brad.king at kitware.com>
AuthorDate: Thu Aug 25 10:59:42 2016 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Aug 25 10:59:42 2016 -0400
Merge topic 'test-driver-clang-tidy' into next
cd344e3a create_test_sourcelist: Use safer strncpy instead of strcpy
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=cd344e3a62e3a6728e5b749cb923104c2c09949c
commit cd344e3a62e3a6728e5b749cb923104c2c09949c
Author: Sylvain Joubert <joubert.sy at gmail.com>
AuthorDate: Thu Aug 25 11:54:28 2016 +0200
Commit: Brad King <brad.king at kitware.com>
CommitDate: Thu Aug 25 10:56:50 2016 -0400
create_test_sourcelist: Use safer strncpy instead of strcpy
Clang-tidy advises to use a safer function in place of strcpy.
This should avoid such warnings in user build using clang-tidy.
diff --git a/Templates/TestDriver.cxx.in b/Templates/TestDriver.cxx.in
index ffa6999..3e0afa5 100644
--- a/Templates/TestDriver.cxx.in
+++ b/Templates/TestDriver.cxx.in
@@ -33,19 +33,21 @@ static functionMapEntry cmakeGeneratedFunctionMapEntries[] = {
static char* lowercase(const char *string)
{
char *new_string, *p;
+ size_t stringSize = 0;
#ifdef __cplusplus
- new_string = static_cast<char *>(malloc(sizeof(char) *
- static_cast<size_t>(strlen(string) + 1)));
+ stringSize = static_cast<size_t>(strlen(string) + 1);
+ new_string = static_cast<char *>(malloc(sizeof(char) * stringSize));
#else
- new_string = (char *)(malloc(sizeof(char) * (size_t)(strlen(string) + 1)));
+ stringSize = (size_t)(strlen(string) + 1);
+ new_string = (char *)(malloc(sizeof(char) * stringSize));
#endif
if (!new_string)
{
return 0;
}
- strcpy(new_string, string);
+ strncpy(new_string, string, stringSize);
p = new_string;
while (*p != 0)
{
-----------------------------------------------------------------------
Summary of changes:
Templates/TestDriver.cxx.in | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list