diff options
author | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-02-18 03:58:04 -0600 |
---|---|---|
committer | Norbert Thiebaud <nthiebaud@gmail.com> | 2013-02-22 07:50:50 +0000 |
commit | 0be1b5f4a64b53aee054d29db2bee2eb37f5131e (patch) | |
tree | d997b1f24ff09fb9c62d25815c2d394ebf4f5c92 /xmlsecurity/source | |
parent | 975e2694762e011f7028755c140151fb4fdc6b1f (diff) |
coverity#982735 Negative loop bound
Change-Id: I597cd1204b0b7f5c7351482c3cdd00fc6111218a
Reviewed-on: https://gerrit.libreoffice.org/2224
Reviewed-by: Norbert Thiebaud <nthiebaud@gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud@gmail.com>
Diffstat (limited to 'xmlsecurity/source')
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 20 |
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 :: |