1
0
Fork 0
forked from suyu/suyu

startup_checks: Resolve -Wstringop-truncation

Copies up to sizeof(p_name) - 1 in strncpy and null terminates it at p_name[254]
This commit is contained in:
Morph 2022-10-21 02:34:08 -04:00
parent f86774c1ac
commit bb31b0f261

View file

@ -135,7 +135,8 @@ bool SpawnChild(const char* arg0, PROCESS_INFORMATION* pi, int flags) {
startup_info.cb = sizeof(startup_info);
char p_name[255];
std::strncpy(p_name, arg0, 255);
std::strncpy(p_name, arg0, 254);
p_name[254] = '\0';
const bool process_created = CreateProcessA(nullptr, // lpApplicationName
p_name, // lpCommandLine