Commit 64199a0f authored by Artur Wojcik's avatar Artur Wojcik
Browse files

change std::copy() to std::strncpy() for cmdline

parent e314f8fb
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
// cppcheck-suppress definePrefix // cppcheck-suppress definePrefix
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <Windows.h>
#include <cstring>
#else #else
#include <unistd.h> #include <unistd.h>
#endif #endif
...@@ -217,11 +218,11 @@ int exec(const std::pair<std::string, std::string>& command, F f) ...@@ -217,11 +218,11 @@ int exec(const std::pair<std::string, std::string>& command, F f)
info.hStdInput = input.get_read_handle(); info.hStdInput = input.get_read_handle();
info.dwFlags |= STARTF_USESTDHANDLES; info.dwFlags |= STARTF_USESTDHANDLES;
TCHAR cmdline[MAX_PATH];
std::copy(std::begin(cmd), std::end(cmd), std::begin(cmdline));
ZeroMemory(&process_info, sizeof(process_info)); ZeroMemory(&process_info, sizeof(process_info));
TCHAR cmdline[MAX_PATH];
std::strncpy(cmd.c_str(), cmdline, MAX_PATH);
if(CreateProcess(nullptr, if(CreateProcess(nullptr,
cmdline, cmdline,
nullptr, nullptr,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment