[WIN32K]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 27 Oct 2010 17:08:40 +0000 (17:08 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Wed, 27 Oct 2010 17:08:40 +0000 (17:08 +0000)
Fix possible NULL pointer dereferences. Spotted by Amine Khaldi.

svn path=/trunk/; revision=49309

reactos/subsystems/win32/win32k/ntuser/keyboard.c
reactos/subsystems/win32/win32k/ntuser/message.c

index 62b2d7d..04be007 100644 (file)
@@ -941,6 +941,12 @@ W32kKeyProcessMessage(LPMSG Msg,
          VscVkTable = KeyboardLayout->pVSCtoVK_E1;
       }
 
+      if (!VscVkTable)
+      {
+          DPRINT1("somethings wrong, Prefix=0x%x", Prefix);
+          return;
+      }
+
       RawVk = 0xff;
       while (VscVkTable->Vsc)
       {
index afec69e..319e599 100644 (file)
@@ -2492,18 +2492,23 @@ NtUserMessageCall(
    UserEnterExclusive();
 
    /* Validate input */
-   if (hWnd && (hWnd != INVALID_HANDLE_VALUE) && !(Window = UserGetWindowObject(hWnd)))
+   if (hWnd && (hWnd != INVALID_HANDLE_VALUE))
    {
-      UserLeave();
-      return FALSE;
+      Window = UserGetWindowObject(hWnd);
+      if (!Window)
+      {
+        UserLeave();
+        return FALSE;
+      }
    }
+
    switch(dwType)
    {
       case FNID_DEFWINDOWPROC:
-         UserRefObjectCo(Window, &Ref);
+         if (Window) UserRefObjectCo(Window, &Ref);
          lResult = IntDefWindowProc(Window, Msg, wParam, lParam, Ansi);
          Ret = TRUE;
-         UserDerefObjectCo(Window);
+         if (Window) UserDerefObjectCo(Window);
       break;
       case FNID_SENDNOTIFYMESSAGE:
          Ret = UserSendNotifyMessage(hWnd, Msg, wParam, lParam);