Commit d473c09c authored by Tim Clem's avatar Tim Clem Committed by Alexandre Julliard

wininet: Treat dwUrlLength as a maximum in InternetCrackUrlW.

parent 681ce692
...@@ -1646,7 +1646,13 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF ...@@ -1646,7 +1646,13 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
SetLastError(ERROR_INVALID_PARAMETER); SetLastError(ERROR_INVALID_PARAMETER);
return FALSE; 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) if (dwFlags & ICU_DECODE)
{ {
......
...@@ -855,7 +855,6 @@ static void InternetCrackUrlW_test(void) ...@@ -855,7 +855,6 @@ static void InternetCrackUrlW_test(void)
comp.dwHostNameLength = ARRAY_SIZE(host); comp.dwHostNameLength = ARRAY_SIZE(host);
r = InternetCrackUrlW(url3, 13 /* includes the nul */, 0, &comp); r = InternetCrackUrlW(url3, 13 /* includes the nul */, 0, &comp);
ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError()); ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError());
todo_wine
ok(comp.dwHostNameLength == 5, ok(comp.dwHostNameLength == 5,
"Expected dwHostNameLength of 5, got %d\n", comp.dwHostNameLength); "Expected dwHostNameLength of 5, got %d\n", comp.dwHostNameLength);
...@@ -877,7 +876,6 @@ static void InternetCrackUrlW_test(void) ...@@ -877,7 +876,6 @@ static void InternetCrackUrlW_test(void)
comp.dwUrlPathLength = ARRAY_SIZE(urlpart); comp.dwUrlPathLength = ARRAY_SIZE(urlpart);
r = InternetCrackUrlW(url5, 15, 0, &comp); r = InternetCrackUrlW(url5, 15, 0, &comp);
ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError()); ok(r, "InternetCrackUrlW failed with error %d\n", GetLastError());
todo_wine
ok(comp.dwUrlPathLength == 0, ok(comp.dwUrlPathLength == 0,
"Expected dwUrlPathLength of 0, got %d\n", comp.dwUrlPathLength); "Expected dwUrlPathLength of 0, got %d\n", comp.dwUrlPathLength);
} }
......
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