propsheet: catch potential use of null pointers

Aric Stewart aric at codeweavers.com
Fri Oct 1 13:52:35 CDT 2004


check to make sure PropSheetInfo* is not null before dereferencing it 
for some windows messages.
-------------- next part --------------
Index: dlls/comctl32/propsheet.c
===================================================================
RCS file: /home/wine/wine/dlls/comctl32/propsheet.c,v
retrieving revision 1.120
diff -u -r1.120 propsheet.c
--- dlls/comctl32/propsheet.c	20 Sep 2004 19:13:36 -0000	1.120
+++ dlls/comctl32/propsheet.c	1 Oct 2004 18:44:58 -0000
@@ -3413,6 +3413,9 @@
       {
           PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd, PropSheetInfoStr);
 
+          if (!psInfo)
+              return FALSE;
+
           /* No default handler, forward notification to active page */
           if (psInfo->activeValid && psInfo->active_page != -1)
           {
@@ -3448,6 +3451,9 @@
                                                         PropSheetInfoStr);
       HWND hwndPage = 0;
 
+      if (!psInfo)
+        return FALSE;
+
       if (psInfo->activeValid && psInfo->active_page != -1)
         hwndPage = psInfo->proppage[psInfo->active_page].hwndPage;
 
@@ -3509,6 +3515,9 @@
       PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd,
                                                         PropSheetInfoStr);
 
+      if (!psInfo)
+        return FALSE;
+
       psInfo->restartWindows = TRUE;
       return TRUE;
     }
@@ -3517,6 +3526,9 @@
     {
       PropSheetInfo* psInfo = (PropSheetInfo*) GetPropW(hwnd,
                                                         PropSheetInfoStr);
+
+      if (!psInfo)
+        return FALSE;
 
       psInfo->rebootSystem = TRUE;
       return TRUE;


More information about the wine-patches mailing list