[PATCH 4/4] wininet: Cut of the query string before searching for the filename in CreateUrlCacheEntryW().

Henri Verbeet hverbeet at codeweavers.com
Thu Sep 23 04:48:05 CDT 2010


Apparently it's possible to receive URLs with e.g. slashes in the query
string. I was under the impression those were reserved in the query string,
but e.g. Firefox will happily accept them as well.
---
 dlls/wininet/urlcache.c |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/wininet/urlcache.c b/dlls/wininet/urlcache.c
index a220e33..2129f42 100644
--- a/dlls/wininet/urlcache.c
+++ b/dlls/wininet/urlcache.c
@@ -2271,6 +2271,12 @@ BOOL WINAPI CreateUrlCacheEntryW(
     if (((lpszUrlEnd - lpszUrlName) > 1) && (*(lpszUrlEnd - 1) == '/' || *(lpszUrlEnd - 1) == '\\'))
         lpszUrlEnd--;
 
+    lpszUrlPart = memchrW(lpszUrlName, '?', lpszUrlEnd - lpszUrlName);
+    if (!lpszUrlPart)
+        lpszUrlPart = memchrW(lpszUrlName, '#', lpszUrlEnd - lpszUrlName);
+    if (lpszUrlPart)
+        lpszUrlEnd = lpszUrlPart;
+
     for (lpszUrlPart = lpszUrlEnd; 
         (lpszUrlPart >= lpszUrlName); 
         lpszUrlPart--)
@@ -2281,10 +2287,6 @@ BOOL WINAPI CreateUrlCacheEntryW(
             lpszUrlPart++;
             break;
         }
-        else if(*lpszUrlPart == '?' || *lpszUrlPart == '#')
-        {
-            lpszUrlEnd = lpszUrlPart;
-        }
     }
     if (!lstrcmpW(lpszUrlPart, szWWW))
     {
-- 
1.7.2.2




More information about the wine-patches mailing list