Commit 0f958ec3 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

wininet: The buffer is returned from InternetGetLastResponseInfo() even when the error is 0.

parent e4e2e338
......@@ -1099,14 +1099,12 @@ BOOL WINAPI InternetGetLastResponseInfoA(LPDWORD lpdwError,
return FALSE;
}
*lpdwError = lpwite->dwError;
if (lpwite->dwError && *lpdwBufferLength)
if (*lpdwBufferLength)
{
memcpy(lpszBuffer, lpwite->response, *lpdwBufferLength);
lpszBuffer[*lpdwBufferLength - 1] = 0;
*lpdwBufferLength = strlen(lpszBuffer);
}
else
*lpdwBufferLength = 0;
}
else
{
......@@ -1149,10 +1147,8 @@ BOOL WINAPI InternetGetLastResponseInfoW(LPDWORD lpdwError,
return FALSE;
}
*lpdwError = lpwite->dwError;
if (lpwite->dwError && *lpdwBufferLength)
if (*lpdwBufferLength)
*lpdwBufferLength = MultiByteToWideChar(CP_ACP, 0, lpwite->response, -1, lpszBuffer, *lpdwBufferLength);
else
*lpdwBufferLength = 0;
}
else
{
......
......@@ -706,6 +706,8 @@ static void test_command(HINTERNET hFtp)
BOOL ret;
DWORD error;
unsigned int i;
BOOL had_error_zero = FALSE;
BOOL had_error_zero_size_positive = FALSE;
static const struct
{
BOOL ret;
......@@ -776,8 +778,12 @@ static void test_command(HINTERNET hFtp)
ret = InternetGetLastResponseInfoA(&error, buffer, &size);
ok(ret, "%d: got ret %d\n", i, ret);
ok(size == 0 || strlen(buffer) == size, "%d: size %d, buffer size %d\n", i, size, size ? strlen(buffer) : 0);
had_error_zero |= (error == 0);
had_error_zero_size_positive |= (error == 0 && size > 0);
HeapFree(GetProcessHeap(), 0, buffer);
}
ok(!had_error_zero || had_error_zero_size_positive, "never observed error 0 with positive size\n");
}
static void test_find_first_file(HINTERNET hFtp, HINTERNET hConnect)
......
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