wininet: Fix FtpGetCurrentDirectoryW to handle bad input.

This commit is contained in:
Zac Brown 2007-12-01 17:21:07 -05:00 committed by Alexandre Julliard
parent b94ebc4ebf
commit b9b900f4b8
1 changed files with 19 additions and 1 deletions

View File

@ -885,12 +885,30 @@ BOOL WINAPI FtpGetCurrentDirectoryW(HINTERNET hFtpSession, LPWSTR lpszCurrentDir
TRACE("len(%d)\n", *lpdwCurrentDirectory); TRACE("len(%d)\n", *lpdwCurrentDirectory);
lpwfs = (LPWININETFTPSESSIONW) WININET_GetObject( hFtpSession ); lpwfs = (LPWININETFTPSESSIONW) WININET_GetObject( hFtpSession );
if (NULL == lpwfs || WH_HFTPSESSION != lpwfs->hdr.htype) if (NULL == lpwfs)
{
INTERNET_SetLastError(ERROR_INVALID_HANDLE);
goto lend;
}
if (WH_HFTPSESSION != lpwfs->hdr.htype)
{ {
INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE);
goto lend; goto lend;
} }
if (!lpdwCurrentDirectory)
{
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
goto lend;
}
if (lpszCurrentDirectory == NULL)
{
INTERNET_SetLastError(ERROR_INSUFFICIENT_BUFFER);
goto lend;
}
if (lpwfs->download_in_progress != NULL) if (lpwfs->download_in_progress != NULL)
{ {
INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS); INTERNET_SetLastError(ERROR_FTP_TRANSFER_IN_PROGRESS);