summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index a3bda1367f42..f3eacea08c16 100644
--- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
+++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
@@ -690,7 +690,8 @@ Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromRa
return xcert ;
}
-Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromAscii( const OUString& asciiCertificate ) throw( SecurityException , RuntimeException ) {
+Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromAscii( const OUString& asciiCertificate ) throw( SecurityException , RuntimeException )
+{
xmlChar* chCert ;
xmlSecSize certSize ;
@@ -700,13 +701,20 @@ Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromAs
certSize = xmlSecBase64Decode( chCert, ( xmlSecByte* )chCert, xmlStrlen( chCert ) ) ;
- Sequence< sal_Int8 > rawCert( certSize ) ;
- for( unsigned int i = 0 ; i < certSize ; i ++ )
- rawCert[i] = *( chCert + i ) ;
+ if(certSize > 0)
+ {
+ Sequence< sal_Int8 > rawCert( certSize ) ;
+ for( unsigned int i = 0 ; i < certSize ; i ++ )
+ rawCert[i] = *( chCert + i ) ;
- xmlFree( chCert ) ;
+ xmlFree( chCert ) ;
- return createCertificateFromRaw( rawCert ) ;
+ return createCertificateFromRaw( rawCert ) ;
+ }
+ else
+ {
+ return NULL;
+ }
}
sal_Int32 SecurityEnvironment_NssImpl ::