Signed-off-by: Tim Clem tclem@codeweavers.com --- Simplified the code here and removed the TRACE.
dlls/wininet/internet.c | 8 +++++++- dlls/wininet/tests/url.c | 2 -- 2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 1b6f060d607..7816d2729b7 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -1636,7 +1636,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) { diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c index 9476d4309c3..59b66a5404c 100644 --- a/dlls/wininet/tests/url.c +++ b/dlls/wininet/tests/url.c @@ -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); }