[dataset] validate Active/Pending Timestamp and Delay Timer TLVs (#11088)

This commit updates the `Dataset::IsTlvValid()` method to also
validate the Active/Pending Timestamp and Delay Timer TLVs, ensuring
they have the minimum required length. This ensures that a dataset
with invalid TLVs is correctly rejected when set on a device.
This commit is contained in:
Abtin Keshavarzian
2024-12-26 16:19:40 -08:00
committed by GitHub
parent 1063090817
commit 151444f7dd
+9
View File
@@ -130,6 +130,15 @@ bool Dataset::IsTlvValid(const Tlv &aTlv)
switch (aTlv.GetType())
{
case Tlv::kActiveTimestamp:
minLength = sizeof(ActiveTimestampTlv::ValueType);
break;
case Tlv::kPendingTimestamp:
minLength = sizeof(PendingTimestampTlv::ValueType);
break;
case Tlv::kDelayTimer:
minLength = sizeof(DelayTimerTlv::UintValueType);
break;
case Tlv::kPanId:
minLength = sizeof(PanIdTlv::UintValueType);
break;