diff --git a/src/core/thread/network_data_tlvs.hpp b/src/core/thread/network_data_tlvs.hpp index 273c89550..b5ac530c4 100644 --- a/src/core/thread/network_data_tlvs.hpp +++ b/src/core/thread/network_data_tlvs.hpp @@ -1128,7 +1128,10 @@ public: * @retval TRUE If the TLV appears to be well-formed. * @retval FALSE If the TLV does not appear to be well-formed. */ - bool IsValid(void) const { return GetLength() >= sizeof(*this) - sizeof(NetworkDataTlv); } + bool IsValid(void) const + { + return (GetLength() >= sizeof(*this) - sizeof(NetworkDataTlv)) && (GetContextId() != 0); + } /** * Indicates whether or not the Compress flag is set.