Aric Stewart : wininet: When cracking a cookie url discard the webpage and ensure at least a path of '/'.
Alexandre Julliard
julliard at winehq.org
Wed Feb 18 10:15:32 CST 2009
Module: wine
Branch: master
Commit: 99a7ed9f4fcd638e21d600e7fbc7972dc772d8f6
URL: http://source.winehq.org/git/wine.git/?a=commit;h=99a7ed9f4fcd638e21d600e7fbc7972dc772d8f6
Author: Aric Stewart <aric at codeweavers.com>
Date: Tue Feb 17 10:28:54 2009 -0600
wininet: When cracking a cookie url discard the webpage and ensure at least a path of '/'.
---
dlls/wininet/cookie.c | 18 +++++++++++++++++-
1 files changed, 17 insertions(+), 1 deletions(-)
diff --git a/dlls/wininet/cookie.c b/dlls/wininet/cookie.c
index 1a4b5fb..60afc03 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 */
More information about the wine-cvs
mailing list