diff options
author | Rolf Eike Beer <eike@sf-mail.de> | 2017-10-08 16:15:31 (GMT) |
---|---|---|
committer | Rolf Eike Beer <eike@sf-mail.de> | 2017-10-08 16:36:09 (GMT) |
commit | a483b7eac257381a98deb750f516e3e699dfbce4 (patch) | |
tree | ebdd20783a66bd2098ce68f2cea0d1f506c19be3 /Source/cmTryRunCommand.cxx | |
parent | 4e96dc02c3a305644d935550ae3dd01df61a45b0 (diff) | |
download | CMake-a483b7eac257381a98deb750f516e3e699dfbce4.zip CMake-a483b7eac257381a98deb750f516e3e699dfbce4.tar.gz CMake-a483b7eac257381a98deb750f516e3e699dfbce4.tar.bz2 |
TryRun: do not call strcpy()
Diffstat (limited to 'Source/cmTryRunCommand.cxx')
-rw-r--r-- | Source/cmTryRunCommand.cxx | 9 |
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); } |