summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2017-10-10 13:10:51 (GMT)
committerKitware Robot <kwrobot@kitware.com>2017-10-10 13:10:54 (GMT)
commit8af7a16be7290b84c233c5e7749600aa57c4a28a (patch)
tree4bb7ba9e22d179fbc2fbb958058e4a228e18ea1e /Source
parent60c688c6c37e9867462950c2fb2be7f3aef756b4 (diff)
parenta483b7eac257381a98deb750f516e3e699dfbce4 (diff)
downloadCMake-8af7a16be7290b84c233c5e7749600aa57c4a28a.zip
CMake-8af7a16be7290b84c233c5e7749600aa57c4a28a.tar.gz
CMake-8af7a16be7290b84c233c5e7749600aa57c4a28a.tar.bz2
Merge topic 'tryrun-strcpy'
a483b7ea TryRun: do not call strcpy() Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !1364
Diffstat (limited to 'Source')
-rw-r--r--Source/cmTryRunCommand.cxx9
1 files changed, 5 insertions, 4 deletions
diff --git a/Source/cmTryRunCommand.cxx b/Source/cmTryRunCommand.cxx
index dcaa493..932b976 100644
--- a/Source/cmTryRunCommand.cxx
+++ b/Source/cmTryRunCommand.cxx
@@ -4,7 +4,6 @@
#include "cmsys/FStream.hxx"
#include <stdio.h>
-#include <string.h>
#include "cmMakefile.h"
#include "cmState.h"
@@ -191,13 +190,15 @@ void cmTryRunCommand::RunExecutable(const std::string& runArgs,
finalCommand.c_str(), out, out, &retVal, nullptr,
cmSystemTools::OUTPUT_NONE, timeout);
// set the run var
- char retChar[1000];
+ char retChar[16];
+ const char* retStr;
if (worked) {
sprintf(retChar, "%i", retVal);
+ retStr = retChar;
} else {
- strcpy(retChar, "FAILED_TO_RUN");
+ retStr = "FAILED_TO_RUN";
}
- this->Makefile->AddCacheDefinition(this->RunResultVariable, retChar,
+ this->Makefile->AddCacheDefinition(this->RunResultVariable, retStr,
"Result of TRY_RUN",
cmStateEnums::INTERNAL);
}