#2834: Wrong cancelation of the fix: incorrect type of store name parameter in CertOpenStore API call into NetSSL_Win. Release 1.10.0

This commit is contained in:
Günter Obiltschnig
2020-02-04 09:53:47 +01:00
parent 6e321e6256
commit bfa7ca5c82
2 changed files with 12 additions and 12 deletions

View File

@@ -381,13 +381,13 @@ void* X509Certificate::nid2oid(NID nid)
void X509Certificate::loadCertificate(const std::string& certName, const std::string& certStoreName, bool useMachineStore)
{
std::wstring wcertStore;
Poco::UnicodeConverter::convert(certStoreName, wcertStore);
std::wstring wcertStoreName;
Poco::UnicodeConverter::convert(certStoreName, wcertStoreName);
HCERTSTORE hCertStore;
if (useMachineStore)
hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, certStoreName.c_str());
hCertStore = CertOpenStore(CERT_STORE_PROV_SYSTEM, 0, 0, CERT_SYSTEM_STORE_LOCAL_MACHINE, wcertStoreName.c_str());
else
hCertStore = CertOpenSystemStoreW(0, wcertStore.c_str());
hCertStore = CertOpenSystemStoreW(0, wcertStoreName.c_str());
if (!hCertStore) throw CertificateException("Failed to open certificate store", certStoreName, GetLastError());