Commit 58091188 authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

comdlg32: Avoid crash when a path is passed into Open File Dialog.

parent 0414332b
......@@ -1565,10 +1565,16 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
result = GetFullPathNameW(fodInfos->filename, MAX_PATH, tmpBuf, &nameBit);
if (result) {
/* nameBit is always shorter than the original filename */
lstrcpyW(fodInfos->filename,nameBit);
/* nameBit is always shorter than the original filename. It may be NULL
* when the filename contains only a drive name instead of file name */
if (nameBit)
{
lstrcpyW(fodInfos->filename,nameBit);
*nameBit = 0x00;
}
else
*fodInfos->filename = '\0';
*nameBit = 0x00;
MemFree(fodInfos->initdir);
fodInfos->initdir = MemAlloc((lstrlenW(tmpBuf) + 1)*sizeof(WCHAR));
lstrcpyW(fodInfos->initdir, tmpBuf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment