Skip to content

Commit

Permalink
[Thread] fix assertions in operational dataset (#22858)
Browse files Browse the repository at this point in the history
The assertions in `SetExtendedPanId` and `SetMasterKey` would fail if the dataset is exactly 254 bytes after sets it.
  • Loading branch information
jinran-google authored and jmartinez-silabs committed Sep 28, 2022
1 parent f4effe5 commit 05d71d0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/support/ThreadOperationalDataset.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ CHIP_ERROR OperationalDataset::SetExtendedPanId(const uint8_t (&aExtendedPanId)[

tlv->SetValue(aExtendedPanId, sizeof(aExtendedPanId));

assert(mLength + tlv->GetSize() < sizeof(mData));
assert(mLength + tlv->GetSize() <= sizeof(mData));

mLength = static_cast<uint8_t>(mLength + tlv->GetSize());

Expand Down Expand Up @@ -349,7 +349,7 @@ CHIP_ERROR OperationalDataset::SetMasterKey(const uint8_t (&aMasterKey)[kSizeMas

tlv->SetValue(aMasterKey, sizeof(aMasterKey));

assert(mLength + tlv->GetSize() < sizeof(mData));
assert(mLength + tlv->GetSize() <= sizeof(mData));

mLength = static_cast<uint8_t>(mLength + tlv->GetSize());

Expand Down

0 comments on commit 05d71d0

Please sign in to comment.