[Libreoffice-commits] core.git: xmlsecurity/source
Norbert Thiebaud
nthiebaud at gmail.com
Thu Feb 21 23:51:10 PST 2013
xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 20 +++++++---
1 file changed, 14 insertions(+), 6 deletions(-)
New commits:
commit 0be1b5f4a64b53aee054d29db2bee2eb37f5131e
Author: Norbert Thiebaud <nthiebaud at gmail.com>
Date: Mon Feb 18 03:58:04 2013 -0600
coverity#982735 Negative loop bound
Change-Id: I597cd1204b0b7f5c7351482c3cdd00fc6111218a
Reviewed-on: https://gerrit.libreoffice.org/2224
Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx
index a3bda13..f3eacea 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 ::
More information about the Libreoffice-commits
mailing list