Troy Rollo : comdlg32: Prevent SEGV in FILEOPEN95_OnOpen when a malformed filter is passed.

Alexandre Julliard julliard at wine.codeweavers.com
Tue May 30 05:56:52 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: f1bd9ae2daa1f3a234b4d9d0c58fd5e45a9390d3
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=f1bd9ae2daa1f3a234b4d9d0c58fd5e45a9390d3

Author: Troy Rollo <wine at troy.rollo.name>
Date:   Tue May 30 16:54:03 2006 +1000

comdlg32: Prevent SEGV in FILEOPEN95_OnOpen when a malformed filter is passed.

FILEOPEN95_OnOpen assumes that each item in the filter list returns a
non-NULL pointer for CB_GETITEMDATA.

---

 dlls/comdlg32/filedlg.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index 68c2fef..37ce6c2 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -2370,8 +2370,6 @@ static HRESULT FILEDLG95_FILETYPE_Init(H
       CBAddStringW(fodInfos->DlgInfos.hwndFileTypeCB, lpstrDisplay);
 
       nFilters++;
-      /* malformed filters are added anyway... */
-      if (!*lpstrPos) break;
 
       /* Copy the extensions */
       if (!(lpstrExt = MemAlloc((strlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
@@ -2380,6 +2378,9 @@ static HRESULT FILEDLG95_FILETYPE_Init(H
 
       /* Add the item at the end of the combo */
       CBSetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, nFilters-1, lpstrExt);
+
+      /* malformed filters are added anyway... */
+      if (!*lpstrExt) break;
     }
   }
 




More information about the wine-cvs mailing list