Skip to content

Commit 516fb12

Browse files
[Thread] fix assertions in operational dataset (#22858) (#22926)
The assertions in `SetExtendedPanId` and `SetMasterKey` would fail if the dataset is exactly 254 bytes after sets it. Co-authored-by: jinran-google <[email protected]>
1 parent ff98300 commit 516fb12

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)