Skip to content

Commit a8bd389

Browse files
[Thread] fix assertions in operational dataset (#22858)
The assertions in `SetExtendedPanId` and `SetMasterKey` would fail if the dataset is exactly 254 bytes after sets it.
1 parent 99c2e48 commit a8bd389

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib/support/ThreadOperationalDataset.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ CHIP_ERROR OperationalDataset::SetExtendedPanId(const uint8_t (&aExtendedPanId)[
318318

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

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

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

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

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

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

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

0 commit comments

Comments
 (0)