Project

General

Profile

Bug #11515 » ruby-CreateProcessW-memory-error.diff

Rough draft patch to fix memory access errors - docwhat (Christian Höltje), 09/08/2015 04:07 PM

View differences:

win32/win32.c
PROCESS_INFORMATION aProcessInformation;
SECURITY_ATTRIBUTES sa;
struct ChildRecord *child;
WCHAR tmpCmd[MAX_PATH * 2];
if (!cmd && !prog) {
errno = EFAULT;
......
return NULL;
}
/* Make a copy of cmd so CreateProcessW() can modify it if it needs to. */
_tcscpy_s(tmpCmd, MAX_PATH *2, (WCHAR *)cmd);
RUBY_CRITICAL({
fRet = CreateProcessW(prog, (WCHAR *)cmd, psa, psa,
fRet = CreateProcessW(prog, tmpCmd, psa, psa,
psa->bInheritHandle, dwCreationFlags, NULL, NULL,
&aStartupInfo, &aProcessInformation);
errno = map_errno(GetLastError());
    (1-1/1)