summaryrefslogtreecommitdiff
path: root/xmlsecurity
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-05-11 17:46:41 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-05-11 21:05:54 +0100
commitf3e519d4242d66d61d54417645005fff5e3747aa (patch)
tree730ca3da8d8d9ba614e4a7d5a282343275beca61 /xmlsecurity
parenta59a897fa542e40baf4991625c3f3cd66e20d088 (diff)
coverity#982735 Negative loop bound
xmlSecBase64Decode returns int Change-Id: I5bfb273141e62f1355033c669c49af5c645da900
Diffstat (limited to 'xmlsecurity')
-rw-r--r--xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx16
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 ) ;