winhttp/url.c: Fix of invalid behaviour of WinHttpCrackUrl

Maciej Borsz maciejborsz at gmail.com
Mon Mar 15 16:56:48 CDT 2010


Fix of invalid behaviour of WinHttpCrackUrl when in url is '@'.

For example:
WinHttpCrackUrl(L"
http://example.net/[email protected]&var2=x&var3=y", NULL, NULL,
sth)

returned:
scheme(L"http") host(L"example.com&var2=x&var3=y") port(80) path(L"")
extra(L"")

instead of:
scheme(L"http") host(L"example.net") port(80) path(L"/path/") extra(L"?var1=
example at example.com&var2=x&var3=y")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.winehq.org/pipermail/wine-patches/attachments/20100315/50b5701a/attachment.htm>
-------------- next part --------------
From 39b51f660f50c021841250d48171580a8a5e1b87 Mon Sep 17 00:00:00 2001
From: Maciej Borsz <maciejborsz at gmail.com>
Date: Mon, 15 Mar 2010 22:51:59 +0100
Subject: winhttp/url.c: Fix of invalid behaviour of WinHttpCrackUrl

Fix of invalid behaviour of WinHttpCrackUrl when in url is '@'.

For example:
WinHttpCrackUrl(L"http://example.net/[email protected]&var2=x&var3=y", NULL, NULL, sth)

returned:
scheme(L"http") host(L"example.com&var2=x&var3=y") port(80) path(L"") extra(L"")

instead of:
scheme(L"http") host(L"example.net") port(80) path(L"/path/") extra(L"?var1=example at example.com&var2=x&var3=y")
---
 dlls/winhttp/url.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/winhttp/url.c b/dlls/winhttp/url.c
index 49ffc4f..09835b4 100644
--- a/dlls/winhttp/url.c
+++ b/dlls/winhttp/url.c
@@ -133,7 +133,7 @@ BOOL WINAPI WinHttpCrackUrl( LPCWSTR url, DWORD len, DWORD flags, LPURL_COMPONEN
     p += 2;
 
     if (!p[0]) goto exit;
-    if ((q = memchrW( p, '@', len - (p - url) )))
+    if ((q = memchrW( p, '@', len - (p - url) )) && !(memchrW( p, '/', q - p )))
     {
         if ((r = memchrW( p, ':', q - p )))
         {
-- 
1.6.3.3


More information about the wine-patches mailing list