From dac96c2c22d30185831513139cf5944a7988526f Mon Sep 17 00:00:00 2001 From: rongli Date: Wed, 19 Apr 2017 23:42:42 +0800 Subject: [PATCH] Update IsValid() for ConnectivityTlv due to optional SED Buffer Size and Datagram Count (#1624) --- src/core/thread/mle_tlvs.hpp | 3 ++- src/core/thread/network_diagnostic_tlvs.hpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/core/thread/mle_tlvs.hpp b/src/core/thread/mle_tlvs.hpp index 3c7fe56f5..d737dc925 100644 --- a/src/core/thread/mle_tlvs.hpp +++ b/src/core/thread/mle_tlvs.hpp @@ -1014,7 +1014,8 @@ public: * @retval FALSE If the TLV does not appear to be well-formed. * */ - bool IsValid(void) const { return GetLength() == sizeof(*this) - sizeof(Tlv); } + bool IsValid(void) const { return (GetLength() == sizeof(*this) - sizeof(Tlv) || + GetLength() == sizeof(*this) - sizeof(Tlv) - sizeof(mSedBufferSize) - sizeof(mSedDatagramCount)); } /** * This method returns the Parent Priority value. diff --git a/src/core/thread/network_diagnostic_tlvs.hpp b/src/core/thread/network_diagnostic_tlvs.hpp index 436af9d1d..54631d3cf 100644 --- a/src/core/thread/network_diagnostic_tlvs.hpp +++ b/src/core/thread/network_diagnostic_tlvs.hpp @@ -349,7 +349,8 @@ public: * @retval FALSE If the TLV does not appear to be well-formed. * */ - bool IsValid(void) const { return GetLength() == sizeof(*this) - sizeof(NetworkDiagnosticTlv); } + bool IsValid(void) const { return (GetLength() == sizeof(*this) - sizeof(NetworkDiagnosticTlv) || + GetLength() == sizeof(*this) - sizeof(NetworkDiagnosticTlv) - sizeof(mSedBufferSize) - sizeof(mSedDatagramCount)); } /** * This method returns the Parent Priority value.