diff --git a/CefSharp.Core.Runtime/Internals/ClientAdapter.cpp b/CefSharp.Core.Runtime/Internals/ClientAdapter.cpp index e82095b67..71af300dc 100644 --- a/CefSharp.Core.Runtime/Internals/ClientAdapter.cpp +++ b/CefSharp.Core.Runtime/Internals/ClientAdapter.cpp @@ -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 >::const_iterator it = certificates.begin(); @@ -743,8 +744,12 @@ namespace CefSharp bytes->GetData(static_cast(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);