[Libreoffice-commits] core.git: xmlsecurity/source

Samuel Mehrbrodt Samuel.Mehrbrodt at cib.de
Wed Mar 1 12:52:07 UTC 2017


 xmlsecurity/source/dialogs/certificateviewer.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 62e5c2422cfd0e4c7f3ae3a84e9a8462db4a19dc
Author: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
Date:   Wed Mar 1 11:59:51 2017 +0100

    CertificateViewer: Don't crash with empty certificate path
    
    gpg4libre
    
    Change-Id: I4e3d59331a93c0bee98bcc493c2a6aca11005ec4
    Reviewed-on: https://gerrit.libreoffice.org/34741
    Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>
    Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt at cib.de>

diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 0d15353..ebe8712 100644
--- a/xmlsecurity/source/dialogs/certificateviewer.cxx
+++ b/xmlsecurity/source/dialogs/certificateviewer.cxx
@@ -400,9 +400,9 @@ void CertificateViewerCertPathTP::ActivatePage()
 
         sal_Int32 i, nCnt = aCertPath.getLength();
         SvTreeListEntry* pParent = nullptr;
-        for( i = nCnt; i; )
+        for (i = nCnt-1; i >= 0; i--)
         {
-            const Reference< security::XCertificate > rCert = pCertPath[ --i ];
+            const Reference< security::XCertificate > rCert = pCertPath[ i ];
             OUString sName = XmlSec::GetContentPart( rCert->getSubjectName() );
             //Verify the certificate
             sal_Int32 certStatus = mpDlg->mxSecurityEnvironment->verifyCertificate(rCert,
@@ -411,7 +411,8 @@ void CertificateViewerCertPathTP::ActivatePage()
             pParent = InsertCert( pParent, sName, rCert, bCertValid);
         }
 
-        mpCertPathLB->Select( pParent );
+        if (pParent)
+            mpCertPathLB->Select( pParent );
         mpViewCertPB->Disable(); // Own certificate selected
 
         while( pParent )


More information about the Libreoffice-commits mailing list