crypt32: Add parameter checking to CryptSIPCreateIndirectData.

This commit is contained in:
Juan Lang 2010-09-02 18:31:23 -07:00 committed by Alexandre Julliard
parent ea715da1c6
commit 604e39dde5
2 changed files with 5 additions and 13 deletions

View File

@ -715,6 +715,11 @@ BOOL WINAPI CryptSIPCreateIndirectData(SIP_SUBJECTINFO* pSubjectInfo, DWORD* pcb
TRACE("(%p %p %p)\n", pSubjectInfo, pcbIndirectData, pIndirectData); 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))) if ((sip = CRYPT_GetCachedSIP(pSubjectInfo->pgSubjectType)))
ret = sip->info.pfCreate(pSubjectInfo, pcbIndirectData, pIndirectData); ret = sip->info.pfCreate(pSubjectInfo, pcbIndirectData, pIndirectData);
TRACE("returning %d\n", ret); TRACE("returning %d\n", ret);

View File

@ -619,28 +619,17 @@ static void test_sip_create_indirect_data(void)
skip("Missing CryptSIPCreateIndirectData\n"); skip("Missing CryptSIPCreateIndirectData\n");
return; return;
} }
if (0)
{
/* FIXME: crashes Wine */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptSIPCreateIndirectData_p(NULL, NULL, NULL); ret = CryptSIPCreateIndirectData_p(NULL, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); "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); SetLastError(0xdeadbeef);
ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
subjinfo.cbSize = sizeof(subjinfo); subjinfo.cbSize = sizeof(subjinfo);
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
file = create_temp_file(temp_file); file = create_temp_file(temp_file);
@ -655,13 +644,11 @@ if (0)
subjinfo.hFile = file; subjinfo.hFile = file;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
subjinfo.pgSubjectType = &unknown; subjinfo.pgSubjectType = &unknown;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL); ret = CryptSIPCreateIndirectData_p(&subjinfo, NULL, NULL);
todo_wine
ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER, ok(!ret && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); "expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError());
count = 0xdeadbeef; count = 0xdeadbeef;