diff --git a/src/core/meshcop/dataset_manager_ftd.cpp b/src/core/meshcop/dataset_manager_ftd.cpp index bdc18d7e4..1d1a2d586 100644 --- a/src/core/meshcop/dataset_manager_ftd.cpp +++ b/src/core/meshcop/dataset_manager_ftd.cpp @@ -121,10 +121,17 @@ Error DatasetManager::HandleSet(Coap::Message &aMessage, const Ip6::MessageInfo VerifyOrExit(pendingTimestamp.IsValid()); } - // verify the request includes a timestamp that is ahead of the locally stored value - timestamp = (type == Tlv::kActiveTimestamp) ? static_cast(&activeTimestamp) - : static_cast(&pendingTimestamp); + if (type == Tlv::kActiveTimestamp) + { + timestamp = static_cast(&activeTimestamp); + } + else + { + VerifyOrExit(pendingTimestamp.GetLength() > 0); + timestamp = static_cast(&pendingTimestamp); + } + // verify the request includes a timestamp that is ahead of the locally stored value VerifyOrExit(mLocal.Compare(timestamp) > 0); // check channel