fix segfault on missing CSP
These routines: NCryptOpenStorageProvider() winpr_NCryptOpenStorageProviderEx would segfault with PKCS11 support enabled, if the user did not supply a service provider name ("CSP"); they assumed the parameter pszProviderName would always be non-NULL, but it's NULL in that case.
This commit is contained in:
parent
a489c69f10
commit
7bbb8706ee
@ -131,8 +131,8 @@ SECURITY_STATUS NCryptOpenStorageProvider(NCRYPT_PROV_HANDLE* phProvider, LPCWST
|
||||
{
|
||||
|
||||
#ifdef WITH_PKCS11
|
||||
if (_wcscmp(pszProviderName, MS_SMART_CARD_KEY_STORAGE_PROVIDER) == 0 ||
|
||||
_wcscmp(pszProviderName, MS_SCARD_PROV) == 0)
|
||||
if (pszProviderName && (_wcscmp(pszProviderName, MS_SMART_CARD_KEY_STORAGE_PROVIDER) == 0 ||
|
||||
_wcscmp(pszProviderName, MS_SCARD_PROV) == 0))
|
||||
{
|
||||
return winpr_NCryptOpenStorageProviderEx(phProvider, pszProviderName, dwFlags, NULL);
|
||||
}
|
||||
@ -146,8 +146,8 @@ SECURITY_STATUS winpr_NCryptOpenStorageProviderEx(NCRYPT_PROV_HANDLE* phProvider
|
||||
LPCSTR* modulePaths)
|
||||
{
|
||||
#ifdef WITH_PKCS11
|
||||
if (_wcscmp(pszProviderName, MS_SMART_CARD_KEY_STORAGE_PROVIDER) == 0 ||
|
||||
_wcscmp(pszProviderName, MS_SCARD_PROV) == 0)
|
||||
if (pszProviderName && (_wcscmp(pszProviderName, MS_SMART_CARD_KEY_STORAGE_PROVIDER) == 0 ||
|
||||
_wcscmp(pszProviderName, MS_SCARD_PROV) == 0))
|
||||
{
|
||||
return NCryptOpenP11StorageProviderEx(phProvider, pszProviderName, dwFlags, modulePaths);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user