mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[NTVDM]
Correctly NULL-terminate the command-lines when needed (and avoid buffer overruns). svn path=/trunk/; revision=63365
This commit is contained in:
parent
3e159aa702
commit
65a58c440e
2 changed files with 6 additions and 2 deletions
|
@ -119,8 +119,8 @@ static VOID WINAPI DosCmdInterpreterBop(LPWORD Stack)
|
|||
STARTUPINFOA StartupInfo;
|
||||
PROCESS_INFORMATION ProcessInformation;
|
||||
|
||||
/* NULL-terminate the command by removing the return carriage character */
|
||||
while (*CmdPtr != '\r') CmdPtr++;
|
||||
/* NULL-terminate the command line by removing the return carriage character */
|
||||
while (*CmdPtr && *CmdPtr != '\r') CmdPtr++;
|
||||
*CmdPtr = '\0';
|
||||
|
||||
DPRINT1("CMD Run Command '%s'\n", Command);
|
||||
|
|
|
@ -926,6 +926,10 @@ DWORD DosLoadExecutable(IN DOS_EXEC_TYPE LoadType,
|
|||
return ERROR_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
/* NULL-terminate the command line by removing the return carriage character */
|
||||
while (*CommandLine && *CommandLine != '\r') CommandLine++;
|
||||
*(LPSTR)CommandLine = '\0';
|
||||
|
||||
/* Open a handle to the executable */
|
||||
FileHandle = CreateFileA(ExecutablePath,
|
||||
GENERIC_READ,
|
||||
|
|
Loading…
Reference in a new issue