Skip to content

Commit

Permalink
Added a copy constructor for SensitiveDataBuffer (#32426)
Browse files Browse the repository at this point in the history
* Added a copy constructor for SensitiveDataBuffer

* Removed commented code.
  • Loading branch information
thivya-amazon authored and pull[bot] committed May 10, 2024
1 parent bcb4cc8 commit 3381165
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
7 changes: 2 additions & 5 deletions src/app/icd/client/RefreshKeySender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,9 @@ RefreshKeySender::RefreshKeySender(CheckInDelegate * checkInDelegate, const ICDC
ICDClientStorage * icdClientStorage, InteractionModelEngine * engine,
const RefreshKeyBuffer & refreshKeyBuffer) :
mpCheckInDelegate(checkInDelegate),
mICDClientInfo(icdClientInfo), mpICDClientStorage(icdClientStorage), mpImEngine(engine),
mICDClientInfo(icdClientInfo), mpICDClientStorage(icdClientStorage), mpImEngine(engine), mNewKey(refreshKeyBuffer),
mOnConnectedCallback(HandleDeviceConnected, this), mOnConnectionFailureCallback(HandleDeviceConnectionFailure, this)

{
mNewKey = refreshKeyBuffer;
}
{}

CHIP_ERROR RefreshKeySender::RegisterClientWithNewKey(Messaging::ExchangeManager & exchangeMgr, const SessionHandle & sessionHandle)
{
Expand Down
3 changes: 2 additions & 1 deletion src/crypto/CHIPCryptoPAL.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,8 @@ class SensitiveDataBuffer
// Sanitize after use
ClearSecretData(mBytes);
}

SensitiveDataBuffer() {}
SensitiveDataBuffer(const SensitiveDataBuffer & other) { *this = other; }
SensitiveDataBuffer & operator=(const SensitiveDataBuffer & other)
{
// Guard self assignment
Expand Down

0 comments on commit 3381165

Please sign in to comment.