summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-05-28 10:33:40 +0100
committerCaolán McNamara <caolanm@redhat.com>2012-05-28 15:35:25 +0100
commit78f614e5fff70d4874322255cca739f430865f0a (patch)
treea6c2fb97eb9737cbf594f84ff9549ba3069c2a3d /package
parenta59f76154afeb1610f5962da7df3de0b587da38a (diff)
check key size
Change-Id: Ia909b0abb3ef84a9f0a14d42379f693ae9e70812
Diffstat (limited to 'package')
-rw-r--r--package/source/zipapi/ZipFile.cxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/package/source/zipapi/ZipFile.cxx b/package/source/zipapi/ZipFile.cxx
index 16d5a0063302..f154dfeda051 100644
--- a/package/source/zipapi/ZipFile.cxx
+++ b/package/source/zipapi/ZipFile.cxx
@@ -157,6 +157,12 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un
try
{
+ if (xEncryptionData->m_nDerivedKeySize < 0)
+ {
+ throw ZipIOException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid derived key length!") ),
+ uno::Reference< XInterface >() );
+ }
+
uno::Sequence< sal_Int8 > aDerivedKey( xEncryptionData->m_nDerivedKeySize );
if ( rtl_Digest_E_None != rtl_digest_PBKDF2( reinterpret_cast< sal_uInt8* >( aDerivedKey.getArray() ),
aDerivedKey.getLength(),
@@ -192,7 +198,7 @@ uno::Reference< xml::crypto::XCipherContext > ZipFile::StaticGetCipher( const un
uno::Reference< XInterface >() );
}
}
- catch( uno::Exception& )
+ catch( ... )
{
OSL_ENSURE( sal_False, "Can not create cipher context!" );
}
@@ -699,7 +705,7 @@ sal_Bool ZipFile::readLOC( ZipEntry &rEntry )
|| rEntry.nPathLen != nPathLen
|| !rEntry.sPath.equals( sLOCPath );
}
- catch(::std::bad_alloc &)
+ catch(...)
{
bBroken = sal_True;
}