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
1117 1117
    PROCESS_INFORMATION aProcessInformation;
1118 1118
    SECURITY_ATTRIBUTES sa;
1119 1119
    struct ChildRecord *child;
1120
    WCHAR tmpCmd[MAX_PATH * 2];
1120 1121

  
1121 1122
    if (!cmd && !prog) {
1122 1123
	errno = EFAULT;
......
1167 1168
	return NULL;
1168 1169
    }
1169 1170

  
1171
    /* Make a copy of cmd so CreateProcessW() can modify it if it needs to. */
1172
    _tcscpy_s(tmpCmd, MAX_PATH *2, (WCHAR *)cmd);
1173

  
1170 1174
    RUBY_CRITICAL({
1171
	fRet = CreateProcessW(prog, (WCHAR *)cmd, psa, psa,
1175
	fRet = CreateProcessW(prog, tmpCmd, psa, psa,
1172 1176
			      psa->bInheritHandle, dwCreationFlags, NULL, NULL,
1173 1177
			      &aStartupInfo, &aProcessInformation);
1174 1178
	errno = map_errno(GetLastError());