util: fix dangling pointer issues with improper std::stringstream usage (#644)

## Description of change
`std::ostringstream.str()` returns a temporary string so it's invalid to
obtain c_str from it and pass it around.

## Testing
wip
This commit is contained in:
bicarus
2026-04-15 23:25:38 -07:00
committed by GitHub
parent b38160d6c2
commit 6ddae70c5a
3 changed files with 25 additions and 26 deletions
+3 -4
View File
@@ -86,13 +86,12 @@ namespace launcher {
if (LAUNCHER_ARGC > 0) {
// build cmd line
std::stringstream cmd_line;
cmd_line << "START \"\" ";
std::string cmd_line = "START \"\" ";
for (int i = 0; i < LAUNCHER_ARGC; i++)
cmd_line << " \"" << LAUNCHER_ARGV[i] << "\"";
cmd_line += " \"" + std::string(LAUNCHER_ARGV[i]) + "\"";
// run command
system(cmd_line.str().c_str());
system(cmd_line.c_str());
}
}