Fix the case where lpszSearchFile is NULL in FtpFindFirstFile.

This commit is contained in:
Lionel Ulmer 2004-06-01 19:42:43 +00:00 committed by Alexandre Julliard
parent 773784ea01
commit 378dec1519
2 changed files with 6 additions and 4 deletions

View File

@ -606,7 +606,7 @@ HINTERNET WINAPI FtpFindFirstFileW(HINTERNET hConnect,
workRequest.asyncall = FTPFINDFIRSTFILEW;
workRequest.handle = hConnect;
req = &workRequest.u.FtpFindFirstFileW;
req->lpszSearchFile = WININET_strdupW(lpszSearchFile);
req->lpszSearchFile = (lpszSearchFile == NULL) ? NULL : WININET_strdupW(lpszSearchFile);
req->lpFindFileData = lpFindFileData;
req->dwFlags = dwFlags;
req->dwContext= dwContext;
@ -2659,7 +2659,7 @@ HINTERNET FTP_ReceiveFileList(LPWININETFTPSESSIONW lpwfs, INT nSocket, LPCWSTR l
LPWININETFINDNEXTW lpwfn = NULL;
HINTERNET handle = 0;
TRACE("(%p,%d,%p,%ld)\n", lpwfs, nSocket, lpFindFileData, dwContext);
TRACE("(%p,%d,%s,%p,%ld)\n", lpwfs, nSocket, debugstr_w(lpszSearchFile), lpFindFileData, dwContext);
if (FTP_ParseDirectory(lpwfs, nSocket, lpszSearchFile, &lpafp, &dwSize))
{
@ -2878,7 +2878,8 @@ BOOL FTP_ParseNextFile(INT nSocket, LPCWSTR lpszSearchFile, LPFILEPROPERTIESW lp
}
if(lpfp->lpszName) {
if(PathMatchSpecW(lpfp->lpszName, lpszSearchFile)) {
if((lpszSearchFile == NULL) ||
(PathMatchSpecW(lpfp->lpszName, lpszSearchFile))) {
found = TRUE;
TRACE("Matched: %s\n", debugstr_w(lpfp->lpszName));
}

View File

@ -2556,7 +2556,8 @@ VOID INTERNET_ExecuteWork()
req = &workRequest.u.FtpFindFirstFileW;
FTP_FtpFindFirstFileW(workRequest.handle, req->lpszSearchFile,
req->lpFindFileData, req->dwFlags, req->dwContext);
HeapFree(GetProcessHeap(), 0, req->lpszSearchFile);
if (req->lpszSearchFile != NULL)
HeapFree(GetProcessHeap(), 0, req->lpszSearchFile);
}
break;