summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-03-01 11:59:51 +0100
committerSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2017-03-01 12:51:36 +0000
commit62e5c2422cfd0e4c7f3ae3a84e9a8462db4a19dc (patch)
tree1001163f3c10bb97780148d4831cf62a1931323c /xmlsecurity
parent4a8b4a7b3c540b397778d83f7028a07facc97315 (diff)
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@cib.de> Tested-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/dialogs/certificateviewer.cxx7
1 files changed, 4 insertions, 3 deletions
diff --git a/xmlsecurity/source/dialogs/certificateviewer.cxx b/xmlsecurity/source/dialogs/certificateviewer.cxx
index 0d15353b456d..ebe8712c3ce5 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 )