wininet: Avoid crash in InternetCreateUrl with scheme unknown.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=33050
This commit is contained in:
parent
ceea01b165
commit
267a5658fb
2 changed files with 21 additions and 0 deletions
|
@ -4405,6 +4405,12 @@ static BOOL calc_url_length(LPURL_COMPONENTSW lpUrlComponents,
|
||||||
{
|
{
|
||||||
LPCWSTR scheme;
|
LPCWSTR scheme;
|
||||||
|
|
||||||
|
if (lpUrlComponents->nScheme == INTERNET_SCHEME_UNKNOWN)
|
||||||
|
{
|
||||||
|
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
nScheme = lpUrlComponents->nScheme;
|
nScheme = lpUrlComponents->nScheme;
|
||||||
|
|
||||||
if (nScheme == INTERNET_SCHEME_DEFAULT)
|
if (nScheme == INTERNET_SCHEME_DEFAULT)
|
||||||
|
|
|
@ -1231,6 +1231,21 @@ static void InternetCreateUrlA_test(void)
|
||||||
ok(!strcmp(szUrl, CREATE_URL13), "Expected \"%s\", got \"%s\"\n", CREATE_URL13, szUrl);
|
ok(!strcmp(szUrl, CREATE_URL13), "Expected \"%s\", got \"%s\"\n", CREATE_URL13, szUrl);
|
||||||
|
|
||||||
HeapFree(GetProcessHeap(), 0, 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)
|
static void InternetCanonicalizeUrl_test(void)
|
||||||
|
|
Loading…
Add table
Reference in a new issue