Zebediah Figura : kernelbase: Do not allow schemes to be less than two characters in UrlGetPart().
Alexandre Julliard
julliard at winehq.org
Wed Mar 23 17:03:54 CDT 2022
Module: wine
Branch: master
Commit: c2daf4f01e510d81d3627a91138de5f883db6d51
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c2daf4f01e510d81d3627a91138de5f883db6d51
Author: Zebediah Figura <zfigura at codeweavers.com>
Date: Tue Mar 22 23:28:01 2022 -0500
kernelbase: Do not allow schemes to be less than two characters in UrlGetPart().
Signed-off-by: Zebediah Figura <zfigura at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernelbase/path.c | 2 +-
dlls/shlwapi/tests/url.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/kernelbase/path.c b/dlls/kernelbase/path.c
index be7754dade2..917fd644770 100644
--- a/dlls/kernelbase/path.c
+++ b/dlls/kernelbase/path.c
@@ -4198,7 +4198,7 @@ static void parse_url( const WCHAR *url, struct parsed_url *pl )
memset(pl, 0, sizeof(*pl));
pl->scheme = url;
work = parse_scheme( pl->scheme );
- if (*work != ':') return;
+ if (work < url + 2 || *work != ':') return;
pl->scheme_len = work - pl->scheme;
work++;
if (!is_slash( work[0] ) || !is_slash( work[1] ))
diff --git a/dlls/shlwapi/tests/url.c b/dlls/shlwapi/tests/url.c
index 31581f82847..fb3df96e13d 100644
--- a/dlls/shlwapi/tests/url.c
+++ b/dlls/shlwapi/tests/url.c
@@ -714,8 +714,8 @@ static void test_UrlGetPart(void)
{"scheme :", URL_PART_SCHEME, 0, S_FALSE, ""},
{"sch eme:", URL_PART_SCHEME, 0, S_FALSE, ""},
{":", URL_PART_SCHEME, 0, S_FALSE, ""},
- {"a:", URL_PART_SCHEME, 0, S_FALSE, "", .todo_hr = TRUE},
- {"0:", URL_PART_SCHEME, 0, S_FALSE, "", .todo_hr = TRUE},
+ {"a:", URL_PART_SCHEME, 0, S_FALSE, ""},
+ {"0:", URL_PART_SCHEME, 0, S_FALSE, ""},
{"ab:", URL_PART_SCHEME, 0, S_OK, "ab"},
{"about://hostname/", URL_PART_HOSTNAME, 0, E_FAIL},
@@ -868,7 +868,7 @@ static void test_UrlGetPart(void)
size = ARRAY_SIZE(bufferW);
wcscpy(bufferW, L"x");
hr = UrlGetPartW(urlW, bufferW, &size, part, flags);
- todo_wine_if (tests[i].todo_hr && strcmp(url, "a:") && strcmp(url, "0:"))
+ todo_wine_if (tests[i].todo_hr)
ok(hr == (tests[i].hr == S_FALSE ? S_OK : tests[i].hr), "Got hr %#lx.\n", hr);
if (SUCCEEDED(hr))
{
More information about the wine-cvs
mailing list