[1/3] wininet: Correctly set lpszUrlPath in InternetCrackUrlW for urls without path component.

Sebastian Lackner sebastian at fds-team.de
Fri Jul 8 05:07:43 CDT 2016


From: Michael Müller <michael at fds-team.de>

Signed-off-by: Michael Müller <michael at fds-team.de>
Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
---
 dlls/wininet/internet.c  |    4 +---
 dlls/wininet/tests/url.c |    3 +++
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 19cf470..4e1f3b9 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -1917,9 +1917,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
     }
     else
     {
-        if (lpUC->lpszUrlPath && (lpUC->dwUrlPathLength > 0))
-            lpUC->lpszUrlPath[0] = 0;
-        lpUC->dwUrlPathLength = 0;
+        set_url_component(&lpUC->lpszUrlPath, &lpUC->dwUrlPathLength, lpszcp, 0);
     }
 
     TRACE("%s: scheme(%s) host(%s) path(%s) extra(%s)\n", debugstr_wn(lpszUrl,dwUrlLength),
diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c
index 00a457a..0af1d77 100644
--- a/dlls/wininet/tests/url.c
+++ b/dlls/wininet/tests/url.c
@@ -130,6 +130,9 @@ static const crack_url_test_t crack_url_tests[] = {
     {"HtTp://www.winehq.org/scheme",
         0, 4, INTERNET_SCHEME_HTTP, 7, 14, 23, 80, -1, 0, -1, 0, 21, 7, -1, 0,
         "HtTp", "www.winehq.org", "", "", "/scheme", ""},
+    {"http://www.winehq.org",
+        0, 4, INTERNET_SCHEME_HTTP, 7, 14, 23, 80, -1, 0, -1, 0, 21, 0, -1, 0,
+        "http", "www.winehq.org", "", "", "", ""},
     {"file:///C:/Program%20Files/Atmel/AVR%20Tools/STK500/STK500.xml",
         0, 4, INTERNET_SCHEME_FILE, -1, 0, -1, 0, -1, 0, -1, 0, 7, 55, -1, 0,
         "file", "", "", "", "C:\\Program Files\\Atmel\\AVR Tools\\STK500\\STK500.xml", ""},
-- 
2.8.0



More information about the wine-patches mailing list