mirror of
https://github.com/reactos/reactos.git
synced 2024-11-23 11:33:31 +08:00
[WIN32K] Prevent dereferencing NULL pointer
Initialize a window's ThreadListEntry as an empty list on creation and only remove the window from the list on destruction, when the entry is not an empty list. Previously the window creation could fail before the list entry was initialized and the window would get destroyed after that, resulting in a NULL pointer dereference.
This commit is contained in:
parent
41c99aa60a
commit
4661bc006d
@ -596,7 +596,8 @@ LRESULT co_UserFreeWindow(PWND Window,
|
||||
/* remove the window already at this point from the thread window list so we
|
||||
don't get into trouble when destroying the thread windows while we're still
|
||||
in co_UserFreeWindow() */
|
||||
RemoveEntryList(&Window->ThreadListEntry);
|
||||
if (!IsListEmpty(&Window->ThreadListEntry))
|
||||
RemoveEntryList(&Window->ThreadListEntry);
|
||||
|
||||
BelongsToThreadData = IntWndBelongsToThread(Window, ThreadData);
|
||||
|
||||
@ -1917,6 +1918,7 @@ PWND FASTCALL IntCreateWindow(CREATESTRUCTW* Cs,
|
||||
pWnd->HideAccel = pWnd->spwndParent->HideAccel;
|
||||
}
|
||||
|
||||
InitializeListHead(&pWnd->ThreadListEntry);
|
||||
pWnd->head.pti->cWindows++;
|
||||
|
||||
if (Class->spicn && !Class->spicnSm)
|
||||
|
Loading…
Reference in New Issue
Block a user