This fixes an issue when the path includes non-ASCII characters.
Signed-off-by: Jactry Zeng jzeng@codeweavers.com
From: Jactry Zeng jzeng@codeweavers.com
This fixes an issue when the path includes non-ASCII characters.
Signed-off-by: Jactry Zeng jzeng@codeweavers.com --- dlls/mshtml/nsembed.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index c7683a6d06d..2918362c9c0 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -1285,19 +1285,21 @@ void close_gecko(void)
BOOL is_gecko_path(const char *path) { - WCHAR *buf, *ptr; + char unescaped_path[INTERNET_MAX_URL_LENGTH], *ptr; + WCHAR *buf; BOOL ret;
- buf = heap_strdupUtoW(path); - if(!buf || lstrlenW(buf) < gecko_path_len) - return FALSE; - - for(ptr = buf; *ptr; ptr++) { + strcpy(unescaped_path, path); + UrlUnescapeA(unescaped_path, NULL, NULL, URL_UNESCAPE_INPLACE); + for(ptr = unescaped_path; *ptr; ptr++) { if(*ptr == '\') *ptr = '/'; }
- UrlUnescapeW(buf, NULL, NULL, URL_UNESCAPE_INPLACE); + buf = heap_strdupUtoW(unescaped_path); + if(!buf || lstrlenW(buf) < gecko_path_len) + return FALSE; + buf[gecko_path_len] = 0;
ret = !wcsicmp(buf, gecko_path);
Jacek Caban (@jacek) commented about dlls/mshtml/nsembed.c:
BOOL is_gecko_path(const char *path) {
- WCHAR *buf, *ptr;
- char unescaped_path[INTERNET_MAX_URL_LENGTH], *ptr;
- WCHAR *buf; BOOL ret;
- buf = heap_strdupUtoW(path);
- if(!buf || lstrlenW(buf) < gecko_path_len)
return FALSE;
- for(ptr = buf; *ptr; ptr++) {
- strcpy(unescaped_path, path);
- UrlUnescapeA(unescaped_path, NULL, NULL, URL_UNESCAPE_INPLACE);
I think that path is in UTF8 (unless it's specified otherwise by NewURI caller; we don't handle that yet, but I think Gecko doesn't use it another way anyway), while UrlUnescapeA will use CP_ACP.