From 414ff43b12a07e39ca8b0eb4228963ed9257b630 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 18 May 2016 18:29:26 +0200 Subject: [PATCH] urlmon: Unescape path in place in MkProtocol::StartEx. Signed-off-by: Jacek Caban Signed-off-by: Alexandre Julliard --- dlls/urlmon/mk.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/dlls/urlmon/mk.c b/dlls/urlmon/mk.c index 5437b546890..984f381de3b 100644 --- a/dlls/urlmon/mk.c +++ b/dlls/urlmon/mk.c @@ -203,9 +203,8 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, { MkProtocol *This = impl_from_IInternetProtocolEx(iface); LPWSTR mime, progid, display_name, colon_ptr; - DWORD path_size = INTERNET_MAX_URL_LENGTH; DWORD bindf=0, eaten=0, scheme=0, len; - BSTR url, path_tmp, path = NULL; + BSTR url, path = NULL; IParseDisplayName *pdn; BINDINFO bindinfo; STATSTG statstg; @@ -244,22 +243,20 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, CoTaskMemFree(mime); } - hres = IUri_GetPath(pUri, &path_tmp); + hres = IUri_GetPath(pUri, &path); if(FAILED(hres)) return hres; - path = heap_alloc(path_size); - hres = UrlUnescapeW((LPWSTR)path_tmp, path, &path_size, 0); - SysFreeString(path_tmp); - if (FAILED(hres)) - { - heap_free(path); + len = SysStringLen(path)+1; + hres = UrlUnescapeW(path, NULL, &len, URL_UNESCAPE_INPLACE); + if (FAILED(hres)) { + SysFreeString(path); return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER); } + progid = path+1; /* skip '@' symbol */ colon_ptr = strchrW(path, ':'); - if(!colon_ptr) - { - heap_free(path); + if(!colon_ptr) { + SysFreeString(path); return report_result(pOIProtSink, INET_E_RESOURCE_NOT_FOUND, ERROR_INVALID_PARAMETER); } @@ -269,7 +266,7 @@ static HRESULT WINAPI MkProtocol_StartEx(IInternetProtocolEx *iface, IUri *pUri, progid[colon_ptr-progid] = 0; /* overwrite ':' with NULL terminator */ hres = CLSIDFromProgID(progid, &clsid); - heap_free(path); + SysFreeString(path); if(FAILED(hres)) { heap_free(display_name);