Author: tfaber
Date: Fri Apr 15 20:43:25 2016
New Revision: 71165
URL:
http://svn.reactos.org/svn/reactos?rev=71165&view=rev
Log:
[WIN32K:NTUSER]
- Don't access WindowStationName after free
- Handle RtlCreateAtomTable failure
Modified:
trunk/reactos/win32ss/user/ntuser/winsta.c
Modified: trunk/reactos/win32ss/user/ntuser/winsta.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/winsta…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/winsta.c [iso-8859-1] Fri Apr 15 20:43:25 2016
@@ -454,7 +454,7 @@
if (!NT_SUCCESS(Status))
{
- ERR("ObCreateObject failed for window station %wZ\n",
&WindowStationName);
+ ERR("ObCreateObject failed with %lx for window station %wZ\n", Status,
&WindowStationName);
ExFreePoolWithTag(WindowStationName.Buffer, TAG_STRING);
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
return 0;
@@ -464,9 +464,16 @@
RtlZeroMemory(WindowStationObject, sizeof(WINSTATION_OBJECT));
InitializeListHead(&WindowStationObject->DesktopListHead);
- Status = RtlCreateAtomTable(37, &WindowStationObject->AtomTable);
WindowStationObject->Name = WindowStationName;
WindowStationObject->dwSessionId = NtCurrentPeb()->SessionId;
+ Status = RtlCreateAtomTable(37, &WindowStationObject->AtomTable);
+ if (!NT_SUCCESS(Status))
+ {
+ ERR("RtlCreateAtomTable failed with %lx for window station %wZ\n",
Status, &WindowStationName);
+ ObDereferenceObject(WindowStationObject);
+ SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
+ return 0;
+ }
Status = ObInsertObject((PVOID)WindowStationObject,
NULL,
@@ -477,7 +484,7 @@
if (!NT_SUCCESS(Status))
{
- ERR("ObInsertObject failed for window station %wZ\n",
&WindowStationName);
+ ERR("ObInsertObject failed with %lx for window station\n", Status);
SetLastNtError(STATUS_INSUFFICIENT_RESOURCES);
return 0;
}