Fixed selecting multiple files in common file dialog 95-style

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Problem:
	Selecting multiple files in an OpenDialog resulted in a crash, tested with 
PVAstrumento.

Changelog:
	dlls/commdlg/filedlg95.c:
		- Initializing the return-string shouldn't change the pointer.
		- Added "FIXME" for case not handled.
		- Directory and the filenames have to be separated by "\0".
		- Added check to handle possible signed/unsigned overflow.

Index: dlls/commdlg/filedlg95.c
===================================================================
RCS file: /home/wine/wine/dlls/commdlg/filedlg95.c,v
retrieving revision 1.80
diff -r1.80 filedlg95.c
1405c1405
<      ofn->lpstrFile = '\0';
---
>      ofn->lpstrFile[0] = '\0';
1410c1410
<      ofn->lpstrFile = '\0';
---
>      ofn->lpstrFile[0] = '\0';
1452a1453,1459
>   if ( !(fodInfos->ofnInfos->Flags & OFN_EXPLORER) )
>   {
>     /* For "oldstyle" dialog the components have to
>        be spearated by blanks (not '\0'!) and short
>        filenames have to be used! */
>     FIXME("Components have to be separated by blanks");
>   }
1457c1464,1466
<     memcpy( ofn->lpstrFile + nSizePath, lpstrFileList, 
sizeUsed*sizeof(WCHAR) );
---
>     memset( ofn->lpstrFile + nSizePath, 0, sizeof(WCHAR) );
>     memcpy( ofn->lpstrFile + nSizePath + sizeof(WCHAR), lpstrFileList,
> 	    sizeUsed*sizeof(WCHAR) );
1463,1466c1472,1483
<     WideCharToMultiByte(CP_ACP, 0, lpstrPathSpec, -1,
<           ofn->lpstrFile, ofn->nMaxFile, NULL, NULL);
<     WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
<           &ofn->lpstrFile[nSizePath], ofn->nMaxFile - nSizePath, NULL, 
NULL);
---
>     if (ofn->lpstrFile != NULL)
>     {
>       WideCharToMultiByte(CP_ACP, 0, lpstrPathSpec, -1,
> 			  ofn->lpstrFile, ofn->nMaxFile, NULL, NULL);
>       if (ofn->nMaxFile > nSizePath + 1)
>       {
> 	ofn->lpstrFile[nSizePath] = '\0';
> 	WideCharToMultiByte(CP_ACP, 0, lpstrFileList, sizeUsed,
> 			    ofn->lpstrFile + nSizePath + 1,
> 			    ofn->nMaxFile - nSizePath, NULL, NULL);
>       }
>     }



[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux