Skip to content

Commit bce62d1

Browse files
committed
fix(processrunner): use QChar('\0') to fix CreateProcessW error 87
Replacing char literal '\0' appends with QChar('\0') to ensure the environment block is built as a proper null-terminated UTF-16 string. The previous char-literal '\0' was treated as a null pointer constant by the compiler, producing an invalid environment buffer that caused CreateProcessW to fail with ERROR_INVALID_PARAMETER (87). (cherry picked from commit d9ef061)
1 parent f962f82 commit bce62d1

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/core/processrunner_win.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ ProcessRunnerResult WinProcessRunner::run() {
238238
});
239239

240240
// Need 4 \0 to end the environment string, see CreateProcessW() documentation
241-
QString environmentValues =
242-
config.environment.toStringList().join(QChar('\0')) + '\0' + '\0' + '\0' + '\0';
241+
QString environmentValues = config.environment.toStringList().join(QChar('\0')) + QChar('\0') +
242+
QChar('\0') + QChar('\0') + QChar('\0');
243243

244244
QString commandLine = QString(R"("%1" %2)").arg(config.executableFile).arg(config.arguments);
245245

0 commit comments

Comments
 (0)