startup_checks: Resolve -Wstringop-truncation

Copies up to sizeof(p_name) - 1 in strncpy and null terminates it at p_name[254]
master
Morph 2022-10-21 02:34:08 +07:00
parent f86774c1ac
commit bb31b0f261
1 changed files with 2 additions and 1 deletions

@ -135,7 +135,8 @@ bool SpawnChild(const char* arg0, PROCESS_INFORMATION* pi, int flags) {
startup_info.cb = sizeof(startup_info); startup_info.cb = sizeof(startup_info);
char p_name[255]; 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 const bool process_created = CreateProcessA(nullptr, // lpApplicationName
p_name, // lpCommandLine p_name, // lpCommandLine