Fix Browse button generic popup WinBoard
authorH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 5 Jul 2022 13:56:05 +0000 (15:56 +0200)
committerH.G.Muller <hgm@hgm-xboard.(none)>
Tue, 5 Jul 2022 13:56:05 +0000 (15:56 +0200)
The API call to the file selector left some fields in the OPENFILENAME
struct that was passed to it as argument uninitialized. It seems this
could crash WinBoard if they contained unlcky values. (Which they might,
as the struct was a local variable.)

winboard/wsettings.c

index b65566c..dd9cabb 100644 (file)
@@ -512,7 +512,10 @@ LRESULT CALLBACK SettingsProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lPa
                          ofn.hwndOwner = hDlg;\r
                          ofn.hInstance = hInst;\r
                          ofn.lpstrFilter = filter;\r
+                         ofn.lpstrCustomFilter = (LPSTR) NULL;\r
                          ofn.nFilterIndex      = 1L + (ext = activeCps ? 0 : activeList[layoutList[(i-2000)/2+1]].max & 31);\r
+                         ofn.lpstrFileTitle    = NULL;\r
+                         ofn.lpstrInitialDir   = NULL;\r
                          ofn.lpstrDefExt       = defaultExt[ext];\r
                          ofn.lpstrFile = buf;\r
                          ofn.nMaxFile = sizeof(buf);\r