Core - OnSelectClientCertificate copy certificate vector

- Attempt to fix AccessViolationException by making a copy of
  the vector

Issue #2948
This commit is contained in:
Alex Maitland
2022-12-20 11:18:03 +10:00
parent a51da76ad9
commit a51cdd3723
@@ -726,9 +726,10 @@ namespace CefSharp
}
auto browserWrapper = GetBrowserWrapper(browser->GetIdentifier(), browser->IsPopup());
auto callbackWrapper = gcnew CefCertificateCallbackWrapper(callback, certificates);
auto list = gcnew X509Certificate2Collection();
// Create a copy of the vector in an attempt to fix #2948
CefRequestHandler::X509CertificateList certs;
std::vector<CefRefPtr<CefX509Certificate> >::const_iterator it =
certificates.begin();
@@ -743,8 +744,12 @@ namespace CefSharp
bytes->GetData(static_cast<void*>(src), byteSize, 0);
auto cert = gcnew X509Certificate2(bufferByte);
list->Add(cert);
certs.push_back(*it);
}
auto callbackWrapper = gcnew CefCertificateCallbackWrapper(callback, certs);
return handler->OnSelectClientCertificate(
_browserControl, browserWrapper, isProxy,
StringUtils::ToClr(host), port, list, callbackWrapper);