Protect CallWindowProcA/W from NULL pointers

Dmitry Timoshkov dmitry at baikal.ru
Sat Aug 2 09:50:36 CDT 2003


Hello,

Changelog:
    Dmitry Timoshkov <dmitry at codeweavers.com>
    Protect CallWindowProcA/W from NULL pointers.

--- cvs/hq/wine/windows/winproc.c	Thu Jul 10 19:05:02 2003
+++ wine/windows/winproc.c	Sat Aug  2 21:08:57 2003
@@ -2867,9 +2867,12 @@ LRESULT WINAPI CallWindowProcA(
     WPARAM wParam, /* [in] message dependent parameter */
     LPARAM lParam  /* [in] message dependent parameter */
 ) {
-    WINDOWPROC *proc = WINPROC_GetPtr( func );
+    WINDOWPROC *proc;
 
-    if (!proc) return WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
+    if (!func) return 0;
+
+    if (!(proc = WINPROC_GetPtr( func )))
+        return WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
 
 #if testing
     func = WINPROC_GetProc( (WNDPROC)proc, WIN_PROC_32A );
@@ -2903,9 +2906,12 @@ LRESULT WINAPI CallWindowProcA(
 LRESULT WINAPI CallWindowProcW( WNDPROC func, HWND hwnd, UINT msg,
                                   WPARAM wParam, LPARAM lParam )
 {
-    WINDOWPROC *proc = WINPROC_GetPtr( func );
+    WINDOWPROC *proc;
+
+    if (!func) return 0;
 
-    if (!proc) return WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
+    if (!(proc = WINPROC_GetPtr( (WNDPROC)func )))
+        return WINPROC_CallWndProc( func, hwnd, msg, wParam, lParam );
 
 #if testing
     func = WINPROC_GetProc( (WNDPROC)proc, WIN_PROC_32W );






More information about the wine-patches mailing list