From 151444f7dd808aa8fb1431804a6f5649e0569b17 Mon Sep 17 00:00:00 2001 From: Abtin Keshavarzian Date: Thu, 26 Dec 2024 16:19:40 -0800 Subject: [PATCH] [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. --- src/core/meshcop/dataset.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/meshcop/dataset.cpp b/src/core/meshcop/dataset.cpp index be49fdbf3..987ffe5ce 100644 --- a/src/core/meshcop/dataset.cpp +++ b/src/core/meshcop/dataset.cpp @@ -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;