mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 12:13:01 +00:00
[NTOSKRNL]
- Protect against invalid ThreadContext pointer in PspCreateThread. Spotted by Aleksander Andrejevic. CORE-7252 - Fix MSVC warning in HdlspDispatch svn path=/trunk/; revision=60401
This commit is contained in:
parent
a86e82a7d4
commit
5c5939994a
2 changed files with 23 additions and 12 deletions
|
@ -417,7 +417,7 @@ HdlspDispatch(IN HEADLESS_CMD Command,
|
||||||
HeadlessInfo = OutputBuffer;
|
HeadlessInfo = OutputBuffer;
|
||||||
HeadlessInfo->PortType = HeadlessSerialPort;
|
HeadlessInfo->PortType = HeadlessSerialPort;
|
||||||
HeadlessInfo->Serial.TerminalAttached = TRUE;
|
HeadlessInfo->Serial.TerminalAttached = TRUE;
|
||||||
HeadlessInfo->Serial.UsedBiosSettings = HeadlessGlobals->UsedBiosSettings;
|
HeadlessInfo->Serial.UsedBiosSettings = HeadlessGlobals->UsedBiosSettings != 0;
|
||||||
HeadlessInfo->Serial.TerminalBaudRate = HeadlessGlobals->TerminalBaudRate;
|
HeadlessInfo->Serial.TerminalBaudRate = HeadlessGlobals->TerminalBaudRate;
|
||||||
HeadlessInfo->Serial.TerminalType = HeadlessGlobals->TerminalType;
|
HeadlessInfo->Serial.TerminalType = HeadlessGlobals->TerminalType;
|
||||||
|
|
||||||
|
|
|
@ -317,19 +317,30 @@ PspCreateThread(OUT PHANDLE ThreadHandle,
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the Start Addresses */
|
/* Set the Start Addresses from the untrusted ThreadContext */
|
||||||
Thread->StartAddress = (PVOID)KeGetContextPc(ThreadContext);
|
_SEH2_TRY
|
||||||
Thread->Win32StartAddress = (PVOID)KeGetContextReturnRegister(ThreadContext);
|
{
|
||||||
|
Thread->StartAddress = (PVOID)KeGetContextPc(ThreadContext);
|
||||||
|
Thread->Win32StartAddress = (PVOID)KeGetContextReturnRegister(ThreadContext);
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
Status = _SEH2_GetExceptionCode();
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
/* Let the kernel intialize the Thread */
|
/* Let the kernel intialize the Thread */
|
||||||
Status = KeInitThread(&Thread->Tcb,
|
if (NT_SUCCESS(Status))
|
||||||
NULL,
|
{
|
||||||
PspUserThreadStartup,
|
Status = KeInitThread(&Thread->Tcb,
|
||||||
NULL,
|
NULL,
|
||||||
Thread->StartAddress,
|
PspUserThreadStartup,
|
||||||
ThreadContext,
|
NULL,
|
||||||
TebBase,
|
Thread->StartAddress,
|
||||||
&Process->Pcb);
|
ThreadContext,
|
||||||
|
TebBase,
|
||||||
|
&Process->Pcb);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue