[meshcop] add length check to steering data before checking bloom filter (#2222)

We found cases where the device hits a fault when we process steering
data with length = 0. This check will prevent this from happening.
This commit is contained in:
Vaas Krishnamurthy
2017-09-29 00:41:36 -07:00
committed by Jonathan Hui
parent 572fd2c9e2
commit a837af7f6a
+1 -1
View File
@@ -562,7 +562,7 @@ 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() != 0) && (GetLength() <= sizeof(*this) - sizeof(Tlv))); }
/**
* This method sets all bits in the Bloom Filter to zero.