wininet: Treat dwUrlLength as a maximum in InternetCrackUrlW.

Signed-off-by: Tim Clem <tclem@codeweavers.com>
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Tim Clem 2021-07-06 12:40:42 -07:00 committed by Alexandre Julliard
parent 681ce692a0
commit d473c09cc1
2 changed files with 7 additions and 3 deletions

View File

@ -1646,7 +1646,13 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if (!dwUrlLength) dwUrlLength = lstrlenW(lpszUrl);
if (!dwUrlLength)
dwUrlLength = lstrlenW(lpszUrl);
else {
/* Windows stops at a null, regardless of what dwUrlLength says. */
dwUrlLength = wcsnlen(lpszUrl, dwUrlLength);
}
if (dwFlags & ICU_DECODE)
{

View File

@ -855,7 +855,6 @@ static void InternetCrackUrlW_test(void)
comp.dwHostNameLength = ARRAY_SIZE(host);
r = InternetCrackUrlW(url3, 13 /* includes the nul */, 0, &comp);
ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError());
todo_wine
ok(comp.dwHostNameLength == 5,
"Expected dwHostNameLength of 5, got %d\n", comp.dwHostNameLength);
@ -877,7 +876,6 @@ static void InternetCrackUrlW_test(void)
comp.dwUrlPathLength = ARRAY_SIZE(urlpart);
r = InternetCrackUrlW(url5, 15, 0, &comp);
ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError());
todo_wine
ok(comp.dwUrlPathLength == 0,
"Expected dwUrlPathLength of 0, got %d\n", comp.dwUrlPathLength);
}