1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

wininet: Avoid crash in InternetCreateUrl with scheme unknown.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=33050
This commit is contained in:
Bernhard Übelacker 2024-02-12 16:06:23 +01:00 committed by Alexandre Julliard
parent ceea01b165
commit 267a5658fb
2 changed files with 21 additions and 0 deletions

View file

@ -4405,6 +4405,12 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
{
LPCWSTR scheme;
if (lpUrlComponents->nScheme == INTERNET_SCHEME_UNKNOWN)
{
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
nScheme = lpUrlComponents->nScheme;
if (nScheme == INTERNET_SCHEME_DEFAULT)

View file

@ -1231,6 +1231,21 @@ static void InternetCreateUrlA_test(void)
ok(!strcmp(szUrl, CREATE_URL13), "Expected \"%s\", got \"%s\"\n", CREATE_URL13, szUrl);
HeapFree(GetProcessHeap(), 0, szUrl);
memset(&urlComp, 0, sizeof(urlComp));
fill_url_components(&urlComp);
urlComp.lpszScheme = NULL;
urlComp.dwSchemeLength = 0;
urlComp.nScheme = INTERNET_SCHEME_UNKNOWN;
len = 256;
szUrl = HeapAlloc(GetProcessHeap(), 0, len);
SetLastError(0xdeadbeef);
ret = InternetCreateUrlA(&urlComp, 0, szUrl, &len);
ok(!ret, "Expected failure\n");
ok(GetLastError() == ERROR_INVALID_PARAMETER,
"Expected ERROR_INVALID_PARAMETER, got %ld\n", GetLastError());
HeapFree(GetProcessHeap(), 0, szUrl);
}
static void InternetCanonicalizeUrl_test(void)