mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-06 04:03:27 +03:00
TryRun: do not call strcpy()
This commit is contained in:
1 parent
4e96dc02c3
commit
a483b7eac2
1 file changed
+5
-4
@@ -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);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user