From 99a7ed9f4fcd638e21d600e7fbc7972dc772d8f6 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Tue, 17 Feb 2009 10:28:54 -0600 Subject: [PATCH] wininet: When cracking a cookie url discard the webpage and ensure at least a path of '/'. --- dlls/wininet/cookie.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c index 1a4b5fbdced..60afc039ed7 100644 --- a/dlls/wininet/cookie.c +++ b/dlls/wininet/cookie.c @@ -181,6 +181,7 @@ static cookie_domain *COOKIE_addDomain(LPCWSTR domain, LPCWSTR path) static BOOL COOKIE_crackUrlSimple(LPCWSTR lpszUrl, LPWSTR hostName, int hostNameLen, LPWSTR path, int pathLen) { URL_COMPONENTSW UrlComponents; + BOOL rc; UrlComponents.lpszExtraInfo = NULL; UrlComponents.lpszPassword = NULL; @@ -195,7 +196,22 @@ static BOOL COOKIE_crackUrlSimple(LPCWSTR lpszUrl, LPWSTR hostName, int hostName UrlComponents.dwHostNameLength = hostNameLen; UrlComponents.dwUrlPathLength = pathLen; - return InternetCrackUrlW(lpszUrl, 0, 0, &UrlComponents); + rc = InternetCrackUrlW(lpszUrl, 0, 0, &UrlComponents); + + /* discard the webpage off the end of the path */ + if (pathLen > 0 && path[pathLen-1] != '/') + { + LPWSTR ptr; + ptr = strrchrW(path,'/'); + if (ptr) + *(++ptr) = 0; + else + { + path[0] = '/'; + path[1] = 0; + } + } + return rc; } /* match a domain. domain must match if the domain is not NULL. path must match if the path is not NULL */