diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2019-10-15 01:57:12 +0300 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-10-17 09:53:42 +0200 |
commit | d51db77c8d87f210785a8a8c6dd875f7bacddb3c (patch) | |
tree | fd1ab208d49e85371fc9bb321539ce137bdaf719 /sdext/source/pdfimport | |
parent | c8eaadb5d70f42723517bb028f363e37726be256 (diff) |
Remove some memset calls
Replace them with default initialization or calloc
Change-Id: I747f53c2ced2d0473fd5a5ede4f8520a0633dcc1
Reviewed-on: https://gerrit.libreoffice.org/80805
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'sdext/source/pdfimport')
-rw-r--r-- | sdext/source/pdfimport/pdfparse/pdfentries.cxx | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index e57cf3f701b7..b9c3c822c45a 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -1018,13 +1018,13 @@ struct PDFFileImplData sal_uInt32 m_nAlgoVersion; sal_uInt32 m_nStandardRevision; sal_uInt32 m_nKeyLength; - sal_uInt8 m_aOEntry[32]; - sal_uInt8 m_aUEntry[32]; + sal_uInt8 m_aOEntry[32] = {}; + sal_uInt8 m_aUEntry[32] = {}; sal_uInt32 m_nPEntry; OString m_aDocID; rtlCipher m_aCipher; - sal_uInt8 m_aDecryptionKey[ENCRYPTION_KEY_LEN+5]; // maximum handled key length + sal_uInt8 m_aDecryptionKey[ENCRYPTION_KEY_LEN+5] = {}; // maximum handled key length PDFFileImplData() : m_bIsEncrypted( false ), @@ -1035,9 +1035,6 @@ struct PDFFileImplData m_nPEntry( 0 ), m_aCipher( nullptr ) { - memset( m_aOEntry, 0, sizeof( m_aOEntry ) ); - memset( m_aUEntry, 0, sizeof( m_aUEntry ) ); - memset( m_aDecryptionKey, 0, sizeof( m_aDecryptionKey ) ); } ~PDFFileImplData() @@ -1160,8 +1157,7 @@ static bool check_user_password( const OString& rPwd, PDFFileImplData* pData ) memcpy( pData->m_aDecryptionKey, aKey, nKeyLen ); if( pData->m_nStandardRevision == 2 ) { - sal_uInt8 nEncryptedEntry[ENCRYPTION_BUF_LEN]; - memset( nEncryptedEntry, 0, sizeof(nEncryptedEntry) ); + sal_uInt8 nEncryptedEntry[ENCRYPTION_BUF_LEN] = {}; // see PDF reference 1.4 Algorithm 3.4 // encrypt pad string if (rtl_cipher_initARCFOUR( pData->m_aCipher, rtl_Cipher_DirectionEncode, @@ -1241,8 +1237,7 @@ bool PDFFile::setupDecryptionData( const OString& rPwd ) const // try owner password // see PDF reference 1.4 Algorithm 3.7 sal_uInt8 aKey[ENCRYPTION_KEY_LEN]; - sal_uInt8 nPwd[ENCRYPTION_BUF_LEN]; - memset( nPwd, 0, sizeof(nPwd) ); + sal_uInt8 nPwd[ENCRYPTION_BUF_LEN] = {}; sal_uInt32 nKeyLen = password_to_key( rPwd, aKey, m_pData.get(), true ); if( m_pData->m_nStandardRevision == 2 ) { |