kernelbase: Do not allow schemes to be less than two characters in UrlGetPart().

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2022-03-22 23:28:01 -05:00 committed by Alexandre Julliard
parent a521bfd3f4
commit c2daf4f01e
2 changed files with 4 additions and 4 deletions

View File

@ -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] ))

View File

@ -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))
{