diff options
Diffstat (limited to 'xmlsecurity/source')
4 files changed, 16 insertions, 8 deletions
diff --git a/xmlsecurity/source/gpg/SecurityEnvironment.cxx b/xmlsecurity/source/gpg/SecurityEnvironment.cxx index da2310765315..dcddca194762 100644 --- a/xmlsecurity/source/gpg/SecurityEnvironment.cxx +++ b/xmlsecurity/source/gpg/SecurityEnvironment.cxx @@ -162,7 +162,9 @@ Reference< XCertificate > SecurityEnvironmentGpg::getCertificate( const OUString //xmlChar* pSignatureValue=xmlNodeGetContent(cur); OString ostr = OUStringToOString( keyId , RTL_TEXTENCODING_UTF8 ); const xmlChar* strKeyId = reinterpret_cast<const xmlChar*>(ostr.getStr()); - if(xmlSecBase64Decode(strKeyId, const_cast<xmlSecByte*>(strKeyId), xmlStrlen(strKeyId)) < 0) + xmlSecSize nWritten; + int nRet = xmlSecBase64Decode_ex(strKeyId, const_cast<xmlSecByte*>(strKeyId), xmlStrlen(strKeyId), &nWritten); + if(nRet < 0) throw RuntimeException("Base64 decode failed"); m_ctx->setKeyListMode(GPGME_KEYLIST_MODE_LOCAL); diff --git a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx index 3b4e138aebee..dd7a4a14873f 100644 --- a/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx +++ b/xmlsecurity/source/gpg/xmlsignature_gpgimpl.cxx @@ -190,7 +190,9 @@ SAL_CALL XMLSignature_GpgImpl::generate( rCtx.setKeyListMode(GPGME_KEYLIST_MODE_LOCAL); GpgME::Error err; xmlChar* pKey=xmlNodeGetContent(cur); - if(xmlSecBase64Decode(pKey, reinterpret_cast<xmlSecByte*>(pKey), xmlStrlen(pKey)) < 0) + xmlSecSize nWritten; + int nRet = xmlSecBase64Decode_ex(pKey, reinterpret_cast<xmlSecByte*>(pKey), xmlStrlen(pKey), &nWritten); + if(nRet < 0) throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); if( rCtx.addSigningKey( rCtx.key( @@ -358,8 +360,9 @@ SAL_CALL XMLSignature_GpgImpl::validate( if(!xmlSecCheckNodeName(cur, xmlSecNodeSignatureValue, xmlSecDSigNs)) throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); xmlChar* pSignatureValue=xmlNodeGetContent(cur); - int nSigSize = xmlSecBase64Decode(pSignatureValue, reinterpret_cast<xmlSecByte*>(pSignatureValue), xmlStrlen(pSignatureValue)); - if( nSigSize < 0) + xmlSecSize nSigSize; + int nRet = xmlSecBase64Decode_ex(pSignatureValue, reinterpret_cast<xmlSecByte*>(pSignatureValue), xmlStrlen(pSignatureValue), &nSigSize); + if( nRet < 0) throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); GpgME::Data data_signature( @@ -410,8 +413,9 @@ SAL_CALL XMLSignature_GpgImpl::validate( // got a key packet, import & re-validate xmlChar* pKeyPacket=xmlNodeGetContent(cur); - int nKeyLen = xmlSecBase64Decode(pKeyPacket, reinterpret_cast<xmlSecByte*>(pKeyPacket), xmlStrlen(pKeyPacket)); - if( nKeyLen < 0) + xmlSecSize nKeyLen; + nRet = xmlSecBase64Decode_ex(pKeyPacket, reinterpret_cast<xmlSecByte*>(pKeyPacket), xmlStrlen(pKeyPacket), &nKeyLen); + if( nRet < 0) throw RuntimeException("The GpgME library failed to initialize for the OpenPGP protocol."); GpgME::Data data_key( diff --git a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx index f198f839f76b..80ddff58c624 100644 --- a/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx +++ b/xmlsecurity/source/xmlsec/mscrypt/securityenvironment_mscryptimpl.cxx @@ -706,7 +706,8 @@ uno::Reference< XCertificate > SecurityEnvironment_MSCryptImpl::createCertificat xmlChar* chCert = xmlStrndup( reinterpret_cast<const xmlChar*>(oscert.getStr()), static_cast<int>(oscert.getLength()) ) ; - xmlSecSize certSize = xmlSecBase64Decode( chCert, chCert, xmlStrlen( chCert ) ) ; + xmlSecSize certSize; + xmlSecBase64Decode_ex( chCert, chCert, xmlStrlen( chCert ), &certSize ) ; uno::Sequence< sal_Int8 > rawCert( certSize ) ; auto rawCertRange = asNonConstRange(rawCert); diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index f6c35257f80f..97f2ce3b4ea7 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -474,7 +474,8 @@ Reference< XCertificate > SecurityEnvironment_NssImpl::createCertificateFromAsci { OString oscert = OUStringToOString( asciiCertificate , RTL_TEXTENCODING_ASCII_US ) ; xmlChar* chCert = xmlStrndup( reinterpret_cast<const xmlChar*>(oscert.getStr()), static_cast<int>(oscert.getLength()) ) ; - int certSize = xmlSecBase64Decode( chCert, reinterpret_cast<xmlSecByte*>(chCert), xmlStrlen( chCert ) ) ; + xmlSecSize certSize; + xmlSecBase64Decode_ex( chCert, reinterpret_cast<xmlSecByte*>(chCert), xmlStrlen( chCert ), &certSize ) ; if (certSize == 0) return nullptr; |