diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-05-11 17:46:41 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-05-11 21:05:54 +0100 |
commit | f3e519d4242d66d61d54417645005fff5e3747aa (patch) | |
tree | 730ca3da8d8d9ba614e4a7d5a282343275beca61 | |
parent | a59a897fa542e40baf4991625c3f3cd66e20d088 (diff) |
coverity#982735 Negative loop bound
xmlSecBase64Decode returns int
Change-Id: I5bfb273141e62f1355033c669c49af5c645da900
-rw-r--r-- | xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 91b59e3f2a83..498fe1429d08 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -665,19 +665,13 @@ Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromRa Reference< XCertificate > SecurityEnvironment_NssImpl :: createCertificateFromAscii( const OUString& asciiCertificate ) throw( SecurityException , RuntimeException, std::exception ) { - xmlChar* chCert ; - xmlSecSize certSize ; - OString oscert = OUStringToOString( asciiCertificate , RTL_TEXTENCODING_ASCII_US ) ; - - chCert = xmlStrndup( ( const xmlChar* )oscert.getStr(), ( int )oscert.getLength() ) ; - - certSize = xmlSecBase64Decode( chCert, ( xmlSecByte* )chCert, xmlStrlen( chCert ) ) ; - - if(certSize > 0) + xmlChar* chCert = xmlStrndup( ( const xmlChar* )oscert.getStr(), ( int )oscert.getLength() ) ; + int certSize = xmlSecBase64Decode( chCert, ( xmlSecByte* )chCert, xmlStrlen( chCert ) ) ; + if (certSize > 0) { - Sequence< sal_Int8 > rawCert( certSize ) ; - for( unsigned int i = 0 ; i < certSize ; i ++ ) + Sequence< sal_Int8 > rawCert(certSize) ; + for (int i = 0 ; i < certSize; ++i) rawCert[i] = *( chCert + i ) ; xmlFree( chCert ) ; |