diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-03-28 09:59:15 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-03-28 13:13:58 +0000 |
commit | 75af1c483bc16b7cda2289a14dd2d240f24ecaff (patch) | |
tree | 3646d64d5b00af0cdf4dd4e7a5500199e9d47cd6 /oox | |
parent | 761ae519d8f36ece0a0cc070e66a1fdfbad27688 (diff) |
coverity#1130428 Dereference null return value
Change-Id: I557aeb40b4209e2f77383143a8c2665bffea110c
Diffstat (limited to 'oox')
-rw-r--r-- | oox/source/crypto/CryptTools.cxx | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/oox/source/crypto/CryptTools.cxx b/oox/source/crypto/CryptTools.cxx index 69015810a671..6994ca42f4ae 100644 --- a/oox/source/crypto/CryptTools.cxx +++ b/oox/source/crypto/CryptTools.cxx @@ -9,6 +9,7 @@ */ #include "oox/crypto/CryptTools.hxx" +#include <com/sun/star/uno/RuntimeException.hpp> namespace oox { namespace core { @@ -86,14 +87,17 @@ void Crypto::setupContext(vector<sal_uInt8>& key, vector<sal_uInt8>& iv, CryptoT break; } - PK11SlotInfo* aSlot( PK11_GetBestSlot( mechanism, NULL ) ); + PK11SlotInfo* pSlot( PK11_GetBestSlot( mechanism, NULL ) ); + + if (!pSlot) + throw css::uno::RuntimeException("NSS Slot failure", css::uno::Reference<css::uno::XInterface>()); SECItem keyItem; keyItem.type = siBuffer; keyItem.data = &key[0]; keyItem.len = key.size(); - mSymKey = PK11_ImportSymKey( aSlot, mechanism, PK11_OriginUnwrap, CKA_ENCRYPT, &keyItem, NULL ); + mSymKey = PK11_ImportSymKey( pSlot, mechanism, PK11_OriginUnwrap, CKA_ENCRYPT, &keyItem, NULL ); mSecParam = PK11_ParamFromIV( mechanism, pIvItem ); mContext = PK11_CreateContextBySymKey( mechanism, operation, mSymKey, mSecParam ); } |