Merge pull request #10463 from akallabeth/ncrypt_checks

[winpr,ncrypt] check p11 for NULL
This commit is contained in:
David Fort 2024-08-09 11:01:17 +02:00 committed by GitHub
commit 122c6eaeb9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -111,7 +111,7 @@ static SECURITY_STATUS NCryptP11StorageProvider_dtor(NCRYPT_HANDLE handle)
if (provider) if (provider)
{ {
if (provider->p11->C_Finalize) if (provider->p11 && provider->p11->C_Finalize)
rv = provider->p11->C_Finalize(NULL); rv = provider->p11->C_Finalize(NULL);
if (rv != CKR_OK) if (rv != CKR_OK)
{ {
@ -1217,6 +1217,7 @@ static SECURITY_STATUS initialize_pkcs11(HANDLE handle,
goto fail; goto fail;
} }
WINPR_ASSERT(ret->p11);
WINPR_ASSERT(ret->p11->C_Initialize); WINPR_ASSERT(ret->p11->C_Initialize);
rv = ret->p11->C_Initialize(NULL); rv = ret->p11->C_Initialize(NULL);
if (rv != CKR_OK) if (rv != CKR_OK)