[PATCH] wininet: Substitute strchrW with memchrW in InternetCrackUrlW (try 2)

Nigel Liang ncliang at gmail.com
Wed Oct 17 15:17:50 CDT 2007


Hi,

Previous patch had incorrect bounds for memchrW.

-Nigel

---
 dlls/wininet/internet.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 4c1472c..6228f3f 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -1243,7 +1243,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lp
     const WCHAR lpszSeparators[3]={';','?',0};
     const WCHAR lpszSlash[2]={'/',0};
 
-    TRACE("(%s %u %x %p)\n", debugstr_w(lpszUrl), dwUrlLength, dwFlags, lpUC);
+    TRACE("(%s %u %x %p)\n", debugstr_wn(lpszUrl, dwUrlLength), dwUrlLength, dwFlags, lpUC);
 
     if (!lpszUrl_orig || !*lpszUrl_orig || !lpUC)
     {
@@ -1328,7 +1328,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lp
                 /* [<user>[<:password>]@]<host>[:<port>] */
                 /* First find the user and password if they exist */
 
-                lpszHost = strchrW(lpszcp, '@');
+                lpszHost = memchrW(lpszcp, '@', dwUrlLength-(lpszcp-lpszUrl));
                 if (lpszHost == NULL || lpszHost > lpszNetLoc)
                 {
                     /* username and password not specified. */
@@ -1451,7 +1451,7 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lp
             /* Leave the parameter list in lpszUrlPath.  Strip off any trailing
              * newlines if necessary.
              */
-            LPWSTR lpsznewline = strchrW(lpszcp, '\n');
+            LPWSTR lpsznewline = memchrW(lpszcp, '\n', dwUrlLength-(lpszcp-lpszUrl));
             if (lpsznewline != NULL)
                 len = lpsznewline - lpszcp;
             else
-- 
1.4.1




More information about the wine-patches mailing list