Bug 1596666 - Port bug 1578534: Change nsIX509CertDB.constructX509 to take Array<uint8_t>. r=jorgk
authorGeoff Lankow <geoff@darktrojan.net>
Fri, 15 Nov 2019 10:03:44 +0100
changeset 36643 54ccc35a7b0b15be4542c5c2cc12c163e1366c18
parent 36642 54d186205801e6f5c0dbade30c7141c189a1aefc
child 36644 7ab3efcd2527ef7eccb2d072e97f3da77da1170a
push id2534
push userclokep@gmail.com
push dateMon, 02 Dec 2019 19:52:51 +0000
treeherdercomm-beta@055c50840778 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorgk
bugs1596666, 1578534
Bug 1596666 - Port bug 1578534: Change nsIX509CertDB.constructX509 to take Array<uint8_t>. r=jorgk
mailnews/mime/src/nsCMS.cpp
--- a/mailnews/mime/src/nsCMS.cpp
+++ b/mailnews/mime/src/nsCMS.cpp
@@ -122,20 +122,19 @@ NS_IMETHODIMP nsCMSMessage::GetSignerCer
   if (!si) return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIX509Cert> cert;
   if (si->cert) {
     MOZ_LOG(gCMSLog, LogLevel::Debug,
             ("nsCMSMessage::GetSignerCert got signer cert"));
 
     nsCOMPtr<nsIX509CertDB> certdb = do_GetService(NS_X509CERTDB_CONTRACTID);
-    nsDependentCSubstring certDER(
-        reinterpret_cast<char *>(si->cert->derCert.data),
-        si->cert->derCert.len);
-    nsresult rv = certdb->ConstructX509(certDER, getter_AddRefs(cert));
+    nsTArray<uint8_t> certBytes;
+    certBytes.AppendElements(si->cert->derCert.data, si->cert->derCert.len);
+    nsresult rv = certdb->ConstructX509(certBytes, getter_AddRefs(cert));
     NS_ENSURE_SUCCESS(rv, rv);
   } else {
     MOZ_LOG(gCMSLog, LogLevel::Debug,
             ("nsCMSMessage::GetSignerCert no signer cert, do we have a cert "
              "list? %s",
              (si->certList ? "yes" : "no")));
 
     *scert = nullptr;