From 08810169e7fac2beba5869ef2d5e897bc643aed0 Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Wed, 27 Oct 2010 12:51:32 +0000 Subject: [PATCH] [WIN32K] Fix possible NULL pointer dereference. Spotted by Amine Khaldi. svn path=/trunk/; revision=49303 --- reactos/subsystems/win32/win32k/ntuser/event.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/event.c b/reactos/subsystems/win32/win32k/ntuser/event.c index 2c5a91e53c1..e768c2e09d0 100644 --- a/reactos/subsystems/win32/win32k/ntuser/event.c +++ b/reactos/subsystems/win32/win32k/ntuser/event.c @@ -299,17 +299,21 @@ NtUserNotifyWinEvent( UserEnterExclusive(); /* Validate input */ - if (hWnd && (hWnd != INVALID_HANDLE_VALUE) && !(Window = UserGetWindowObject(hWnd))) + if (hWnd && (hWnd != INVALID_HANDLE_VALUE)) { - UserLeave(); - return; + Window = UserGetWindowObject(hWnd); + if (!Window) + { + UserLeave(); + return; + } } if (gpsi->dwInstalledEventHooks & GetMaskFromEvent(Event)) { - UserRefObjectCo(Window, &Ref); + if (Window) UserRefObjectCo(Window, &Ref); IntNotifyWinEvent( Event, Window, idObject, idChild, WEF_SETBYWNDPTI); - UserDerefObjectCo(Window); + if (Window) UserDerefObjectCo(Window); } UserLeave(); } -- 2.17.1