Commit 604e39dd authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Add parameter checking to CryptSIPCreateIndirectData.

parent ea715da1
......@@ -715,6 +715,11 @@ BOOL WINAPI CryptSIPCreateIndirectData(SIP_SUBJECTINFO* pSubjectInfo, DWORD* pcb
TRACE("(%p %p %p)\n", pSubjectInfo, pcbIndirectData, pIndirectData);
if (!pSubjectInfo || !pSubjectInfo->pgSubjectType || !pcbIndirectData)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if ((sip = CRYPT_GetCachedSIP(pSubjectInfo->pgSubjectType)))
ret = sip->info.pfCreate(pSubjectInfo, pcbIndirectData, pIndirectData);
TRACE("returning %d\n", ret);
......
......@@ -619,28 +619,17 @@ static void test_sip_create_indirect_data(void)
skip("Missing CryptSIPCreateIndirectData\n");
return;
}
if (0)
{
/* FIXME: crashes Wine */
SetLastError(0xdeadbeef);
ret = CryptSIPCreateIndirectData_p(NULL, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
}
/* FIXME: this assignment is only to avoid a crash in Wine, it isn't
* needed by native.
*/
subjinfo.pgSubjectType = &unknown;
SetLastError(0xdeadbeef);
ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
subjinfo.cbSize = sizeof(subjinfo);
SetLastError(0xdeadbeef);
ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
file = create_temp_file(temp_file);
......@@ -655,13 +644,11 @@ if (0)
subjinfo.hFile = file;
SetLastError(0xdeadbeef);
ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
subjinfo.pgSubjectType = &unknown;
SetLastError(0xdeadbeef);
ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
count = 0xdeadbeef;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment