wininet: Don't crash on NULL first or last parameter in InternetCrackUrlW.
This commit is contained in:
parent
6493c30c90
commit
d10891eab9
|
@ -1218,16 +1218,15 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR
|
|||
DWORD dwUrlLength = dwUrlLength_orig;
|
||||
const WCHAR lpszSeparators[3]={';','?',0};
|
||||
const WCHAR lpszSlash[2]={'/',0};
|
||||
if(dwUrlLength==0)
|
||||
dwUrlLength=strlenW(lpszUrl);
|
||||
|
||||
TRACE("(%s %u %x %p)\n", debugstr_w(lpszUrl), dwUrlLength, dwFlags, lpUC);
|
||||
|
||||
if (!lpszUrl_orig || !*lpszUrl_orig)
|
||||
if (!lpszUrl_orig || !*lpszUrl_orig || !lpUC)
|
||||
{
|
||||
INTERNET_SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
if (!dwUrlLength) dwUrlLength = strlenW(lpszUrl);
|
||||
|
||||
if (dwFlags & ICU_DECODE)
|
||||
{
|
||||
|
|
|
@ -238,6 +238,7 @@ static void InternetCrackUrlW_test(void)
|
|||
static const WCHAR url2[] = { '.','.','/','R','i','t','z','.','x','m','l',0 };
|
||||
URL_COMPONENTSW comp;
|
||||
WCHAR scheme[20], host[20], user[20], pwd[20], urlpart[50], extra[50];
|
||||
DWORD error;
|
||||
BOOL r;
|
||||
|
||||
urlpart[0]=0;
|
||||
|
@ -261,6 +262,18 @@ static void InternetCrackUrlW_test(void)
|
|||
comp.lpszExtraInfo = extra;
|
||||
comp.dwExtraInfoLength = sizeof extra;
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
r = InternetCrackUrlW(NULL, 0, 0, &comp );
|
||||
error = GetLastError();
|
||||
ok( !r, "InternetCrackUrlW succeeded unexpectedly\n");
|
||||
ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", error);
|
||||
|
||||
SetLastError(0xdeadbeef);
|
||||
r = InternetCrackUrlW(url, 0, 0, NULL );
|
||||
error = GetLastError();
|
||||
ok( !r, "InternetCrackUrlW succeeded unexpectedly\n");
|
||||
ok( error == ERROR_INVALID_PARAMETER, "expected ERROR_INVALID_PARAMETER got %u\n", error);
|
||||
|
||||
r = InternetCrackUrlW(url, 0, 0, &comp );
|
||||
ok( r, "failed to crack url\n");
|
||||
ok( comp.dwSchemeLength == 4, "scheme length wrong\n");
|
||||
|
|
Loading…
Reference in New Issue