[2/2] wininet: Zero buffer used to store current directory in FtpGetCurrentDirectoryA (RESEND)

Zac Brown zac at zacbrown.org
Mon Dec 3 21:58:22 CST 2007


Hi,

Changelog:
* Zero the buffer used to store the current directory to prevent errors from old data



---
 dlls/wininet/ftp.c       |    3 +++
 dlls/wininet/tests/ftp.c |    2 --
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index ce60fa0..203997b 100644
--- a/dlls/wininet/ftp.c
+++ b/dlls/wininet/ftp.c
@@ -830,6 +830,9 @@ BOOL WINAPI FtpGetCurrentDirectoryA(HINTERNET hFtpSession, LPSTR lpszCurrentDire
     WCHAR *dir = NULL;
     DWORD len;
     BOOL ret;
+
+    if(lpszCurrentDirectory && lpdwCurrentDirectory)
+        ZeroMemory(lpszCurrentDirectory, *lpdwCurrentDirectory * sizeof(CHAR));

     if(lpdwCurrentDirectory) {
         len = *lpdwCurrentDirectory;
diff --git a/dlls/wininet/tests/ftp.c b/dlls/wininet/tests/ftp.c
index 1f63752..0598577 100644
--- a/dlls/wininet/tests/ftp.c
+++ b/dlls/wininet/tests/ftp.c
@@ -746,7 +746,6 @@ static void test_get_current_dir(HINTERNET hFtp, HINTERNET hConnect)
     SetLastError(0xdeadbeef);
     bRet = FtpGetCurrentDirectoryA( hFtp, lpszCurrentDirectory, &dwCurrentDirectoryLen );
     ok ( bRet == TRUE, "Expected FtpGetCurrentDirectoryA to pass\n" );
-todo_wine
     ok ( lstrcmp(lpszCurrentDirectory, "/pub") == 0, "Expected returned value \"%s\" to match \"%s\" \n", (char*)lpszCurrentDirectory, "/pub");
     ok ( GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got: %d\n", GetLastError());

@@ -769,7 +768,6 @@ todo_wine
     dwCurrentDirectoryLen = 5;
     bRet = FtpGetCurrentDirectoryA( hFtp, lpszCurrentDirectory, &dwCurrentDirectoryLen );
     ok ( bRet == TRUE, "Expected FtpGetCurrentDirectoryA to pass\n");
-todo_wine
     ok ( lstrcmp(lpszCurrentDirectory, "/pub") == 0, "Expected returned value \"%s\" to match \"%s\" \n", (char*)lpszCurrentDirectory, "/pub");
     ok ( GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got: %d\n", GetLastError());
 }
-- 
1.5.2.5



More information about the wine-patches mailing list