mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Added patch to resize buffer when call to InternetCanonicalizeUrlW fails in InternetCrackUrlW.
This commit is contained in:
parent
b4c93af2cb
commit
5f37cb2071
@ -382,6 +382,7 @@ patch_enable_all ()
|
||||
enable_winhttp_System_Proxy_Autoconfig="$1"
|
||||
enable_wininet_Cleanup="$1"
|
||||
enable_wininet_HttpOpenRequestW="$1"
|
||||
enable_wininet_InternetCrackUrlW="$1"
|
||||
enable_wininet_InternetReadFile="$1"
|
||||
enable_wininet_Internet_Settings="$1"
|
||||
enable_wininet_ParseX509EncodedCertificateForListBoxEntry="$1"
|
||||
@ -1322,6 +1323,9 @@ patch_enable ()
|
||||
wininet-HttpOpenRequestW)
|
||||
enable_wininet_HttpOpenRequestW="$2"
|
||||
;;
|
||||
wininet-InternetCrackUrlW)
|
||||
enable_wininet_InternetCrackUrlW="$2"
|
||||
;;
|
||||
wininet-InternetReadFile)
|
||||
enable_wininet_InternetReadFile="$2"
|
||||
;;
|
||||
@ -7867,6 +7871,27 @@ if test "$enable_wininet_HttpOpenRequestW" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wininet-InternetCrackUrlW
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#40598] Resize buffer when call to InternetCanonicalizeUrlW fails in InternetCrackUrlW
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/wininet/internet.c, dlls/wininet/tests/url.c
|
||||
# |
|
||||
if test "$enable_wininet_InternetCrackUrlW" -eq 1; then
|
||||
patch_apply wininet-InternetCrackUrlW/0001-wininet-Set-lpszUrlPath-to-the-end-of-the-string-in-.patch
|
||||
patch_apply wininet-InternetCrackUrlW/0002-wininet-Resize-buffer-when-call-to-InternetCanonical.patch
|
||||
patch_apply wininet-InternetCrackUrlW/0003-wininet-tests-Fix-typo-lpszPath-lpszUrlPath-in-messa.patch
|
||||
patch_apply wininet-InternetCrackUrlW/0004-wininet-tests-Add-test-to-verify-correct-handling-of.patch
|
||||
(
|
||||
echo '+ { "Michael Müller", "wininet: Set lpszUrlPath to the end of the string in InternetCrackUrlW when dwUrlPathLength > 0.", 1 },';
|
||||
echo '+ { "Michael Müller", "wininet: Resize buffer when call to InternetCanonicalizeUrlW fails in InternetCrackUrlW.", 1 },';
|
||||
echo '+ { "Michael Müller", "wininet/tests: Fix typo (lpszPath -> lpszUrlPath) in messages.", 1 },';
|
||||
echo '+ { "Michael Müller", "wininet/tests: Add test to verify correct handling of urls without a path component.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset wininet-InternetReadFile
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
|
@ -0,0 +1,26 @@
|
||||
From 17acd93aa2405f5c5032f982e77174e4133c8a36 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 16 May 2016 22:34:53 +0200
|
||||
Subject: wininet: Set lpszUrlPath to the end of the string in
|
||||
InternetCrackUrlW when dwUrlPathLength > 0.
|
||||
|
||||
---
|
||||
dlls/wininet/internet.c | 2 ++
|
||||
1 file changed, 2 insertions(+)
|
||||
|
||||
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
|
||||
index 5359794..8149973 100644
|
||||
--- a/dlls/wininet/internet.c
|
||||
+++ b/dlls/wininet/internet.c
|
||||
@@ -1941,6 +1941,8 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
|
||||
{
|
||||
if (lpUC->lpszUrlPath && (lpUC->dwUrlPathLength > 0))
|
||||
lpUC->lpszUrlPath[0] = 0;
|
||||
+ else if (lpUC->dwUrlPathLength > 0)
|
||||
+ lpUC->lpszUrlPath = (WCHAR*)lpszcp;
|
||||
lpUC->dwUrlPathLength = 0;
|
||||
}
|
||||
|
||||
--
|
||||
2.8.0
|
||||
|
@ -0,0 +1,53 @@
|
||||
From 3179cb380b56e3a86385a32ad4b7a3430ff6ae8b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 16 May 2016 22:36:25 +0200
|
||||
Subject: wininet: Resize buffer when call to InternetCanonicalizeUrlW fails in
|
||||
InternetCrackUrlW.
|
||||
|
||||
---
|
||||
dlls/wininet/internet.c | 21 ++++++++++++++++++---
|
||||
1 file changed, 18 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
|
||||
index 8149973..e7dc577 100644
|
||||
--- a/dlls/wininet/internet.c
|
||||
+++ b/dlls/wininet/internet.c
|
||||
@@ -1688,7 +1688,7 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
|
||||
|
||||
if (dwFlags & ICU_DECODE)
|
||||
{
|
||||
- WCHAR *url_tmp;
|
||||
+ WCHAR *url_tmp, *buffer;
|
||||
DWORD len = dwUrlLength + 1;
|
||||
BOOL ret;
|
||||
|
||||
@@ -1697,9 +1697,24 @@ BOOL WINAPI InternetCrackUrlW(const WCHAR *lpszUrl, DWORD dwUrlLength, DWORD dwF
|
||||
SetLastError(ERROR_OUTOFMEMORY);
|
||||
return FALSE;
|
||||
}
|
||||
- ret = InternetCanonicalizeUrlW(url_tmp, url_tmp, &len, ICU_DECODE | ICU_NO_ENCODE);
|
||||
+
|
||||
+ buffer = url_tmp;
|
||||
+ ret = InternetCanonicalizeUrlW(url_tmp, buffer, &len, ICU_DECODE | ICU_NO_ENCODE);
|
||||
+ if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
||||
+ {
|
||||
+ buffer = heap_alloc(len * sizeof(WCHAR));
|
||||
+ if (!buffer)
|
||||
+ {
|
||||
+ SetLastError(ERROR_OUTOFMEMORY);
|
||||
+ heap_free(url_tmp);
|
||||
+ return FALSE;
|
||||
+ }
|
||||
+ ret = InternetCanonicalizeUrlW(url_tmp, buffer, &len, ICU_DECODE | ICU_NO_ENCODE);
|
||||
+ }
|
||||
if (ret)
|
||||
- ret = InternetCrackUrlW(url_tmp, len, dwFlags & ~ICU_DECODE, lpUC);
|
||||
+ ret = InternetCrackUrlW(buffer, len, dwFlags & ~ICU_DECODE, lpUC);
|
||||
+
|
||||
+ if (buffer != url_tmp) heap_free(buffer);
|
||||
heap_free(url_tmp);
|
||||
return ret;
|
||||
}
|
||||
--
|
||||
2.8.0
|
||||
|
@ -0,0 +1,40 @@
|
||||
From afe971bbea3f26a27af206a56957d12e9e3627b3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 16 May 2016 22:38:06 +0200
|
||||
Subject: wininet/tests: Fix typo (lpszPath -> lpszUrlPath) in messages.
|
||||
|
||||
---
|
||||
dlls/wininet/tests/url.c | 8 ++++----
|
||||
1 file changed, 4 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c
|
||||
index 1deae67..00a457a 100644
|
||||
--- a/dlls/wininet/tests/url.c
|
||||
+++ b/dlls/wininet/tests/url.c
|
||||
@@ -246,9 +246,9 @@ static void test_crack_url(const crack_url_test_t *test)
|
||||
test->url, url.dwPasswordLength, test->pass_len);
|
||||
|
||||
if(test->path_off == -1)
|
||||
- ok(!url.lpszUrlPath, "[%s] url.lpszPath = %p, expected NULL\n", test->url, url.lpszUrlPath);
|
||||
+ ok(!url.lpszUrlPath, "[%s] url.lpszUrlPath = %p, expected NULL\n", test->url, url.lpszUrlPath);
|
||||
else
|
||||
- ok(url.lpszUrlPath == test->url+test->path_off, "[%s] url.lpszPath = %p, expected %p\n",
|
||||
+ ok(url.lpszUrlPath == test->url+test->path_off, "[%s] url.lpszUrlPath = %p, expected %p\n",
|
||||
test->url, url.lpszUrlPath, test->url+test->path_off);
|
||||
ok(url.dwUrlPathLength == test->path_len, "[%s] url.lpszUrlPathLength = %d, expected %d\n",
|
||||
test->url, url.dwUrlPathLength, test->path_len);
|
||||
@@ -326,9 +326,9 @@ static void test_crack_url(const crack_url_test_t *test)
|
||||
}
|
||||
|
||||
if(test->path_off == -1)
|
||||
- ok(!urlw.lpszUrlPath, "[%s] urlw.lpszPath = %p, expected NULL\n", test->url, urlw.lpszUrlPath);
|
||||
+ ok(!urlw.lpszUrlPath, "[%s] urlw.lpszUrlPath = %p, expected NULL\n", test->url, urlw.lpszUrlPath);
|
||||
else
|
||||
- ok(urlw.lpszUrlPath == buf+test->path_off, "[%s] urlw.lpszPath = %p, expected %p\n",
|
||||
+ ok(urlw.lpszUrlPath == buf+test->path_off, "[%s] urlw.lpszUrlPath = %p, expected %p\n",
|
||||
test->url, urlw.lpszUrlPath, buf+test->path_off);
|
||||
ok(urlw.dwUrlPathLength == test->path_len, "[%s] urlw.lpszUrlPathLength = %d, expected %d\n",
|
||||
test->url, urlw.dwUrlPathLength, test->path_len);
|
||||
--
|
||||
2.8.0
|
||||
|
@ -0,0 +1,27 @@
|
||||
From 0fda54552d97d22985e050c0c3b9cca36142c945 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 16 May 2016 22:40:28 +0200
|
||||
Subject: wininet/tests: Add test to verify correct handling of urls without a
|
||||
path component.
|
||||
|
||||
---
|
||||
dlls/wininet/tests/url.c | 3 +++
|
||||
1 file changed, 3 insertions(+)
|
||||
|
||||
diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c
|
||||
index 00a457a..0af1d77 100644
|
||||
--- a/dlls/wininet/tests/url.c
|
||||
+++ b/dlls/wininet/tests/url.c
|
||||
@@ -130,6 +130,9 @@ static const crack_url_test_t crack_url_tests[] = {
|
||||
{"HtTp://www.winehq.org/scheme",
|
||||
0, 4, INTERNET_SCHEME_HTTP, 7, 14, 23, 80, -1, 0, -1, 0, 21, 7, -1, 0,
|
||||
"HtTp", "www.winehq.org", "", "", "/scheme", ""},
|
||||
+ {"http://www.winehq.org",
|
||||
+ 0, 4, INTERNET_SCHEME_HTTP, 7, 14, 23, 80, -1, 0, -1, 0, 21, 0, -1, 0,
|
||||
+ "http", "www.winehq.org", "", "", "", ""},
|
||||
{"file:///C:/Program%20Files/Atmel/AVR%20Tools/STK500/STK500.xml",
|
||||
0, 4, INTERNET_SCHEME_FILE, -1, 0, -1, 0, -1, 0, -1, 0, 7, 55, -1, 0,
|
||||
"file", "", "", "", "C:\\Program Files\\Atmel\\AVR Tools\\STK500\\STK500.xml", ""},
|
||||
--
|
||||
2.8.0
|
||||
|
1
patches/wininet-InternetCrackUrlW/definition
Normal file
1
patches/wininet-InternetCrackUrlW/definition
Normal file
@ -0,0 +1 @@
|
||||
Fixes: [40598] Resize buffer when call to InternetCanonicalizeUrlW fails in InternetCrackUrlW
|
Loading…
Reference in New Issue
Block a user