Use DOS_CMDLINE_LENGTH instead of MAX_PATH.
Fix bug in DosInitializePsp which allowed writing past the end of the Program Segment Prefix (PSP).


svn path=/branches/ntvdm/; revision=59693
This commit is contained in:
Aleksandar Andrejevic 2013-08-10 21:41:20 +00:00
parent 2288b2c576
commit b60ee76f22
2 changed files with 3 additions and 3 deletions

View file

@ -864,7 +864,7 @@ VOID DosInitializePsp(WORD PspSegment, LPCSTR CommandLine, WORD ProgramSize, WOR
PspBlock->FarCall[2] = 0xCB; // retf
/* Set the command line */
PspBlock->CommandLineSize = (BYTE)min(strlen(CommandLine), DOS_CMDLINE_LENGTH);
PspBlock->CommandLineSize = (BYTE)min(strlen(CommandLine), DOS_CMDLINE_LENGTH - 1);
RtlCopyMemory(PspBlock->CommandLine, CommandLine, PspBlock->CommandLineSize);
PspBlock->CommandLine[PspBlock->CommandLineSize] = '\r';
}
@ -875,7 +875,7 @@ BOOLEAN DosCreateProcess(LPCSTR CommandLine, WORD EnvBlock)
HANDLE FileHandle = INVALID_HANDLE_VALUE, FileMapping = NULL;
LPBYTE Address = NULL;
LPSTR ProgramFilePath, Parameters[256];
CHAR CommandLineCopy[MAX_PATH];
CHAR CommandLineCopy[DOS_CMDLINE_LENGTH];
INT ParamCount = 0;
WORD Segment = 0;
WORD MaxAllocSize;

View file

@ -77,7 +77,7 @@ BOOL WINAPI ConsoleCtrlHandler(DWORD ControlType)
INT wmain(INT argc, WCHAR *argv[])
{
INT i;
CHAR CommandLine[MAX_PATH];
CHAR CommandLine[DOS_CMDLINE_LENGTH];
DWORD CurrentTickCount;
DWORD LastTickCount = GetTickCount();
DWORD Cycles = 0;