[tlv] change GetSize() return type to uint16_t to avoid overflow (#2870)

Credit to OSS-Fuzz.
This commit is contained in:
Jonathan Hui
2018-07-10 14:13:16 -05:00
committed by GitHub
parent 8c8a953d29
commit af0e3f19fa
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -104,7 +104,7 @@ public:
* @returns The total size include Type, Length, and Value fields.
*
*/
uint8_t GetSize(void) const { return sizeof(Tlv) + mLength; }
uint16_t GetSize(void) const { return sizeof(Tlv) + mLength; }
/**
* This method returns a pointer to the Value.
+1 -1
View File
@@ -1336,7 +1336,7 @@ public:
* @returns The total size of this entry (number of bytes).
*
*/
uint8_t GetSize(void) const { return sizeof(ChannelMaskEntry) + mMaskLength; }
uint16_t GetSize(void) const { return sizeof(ChannelMaskEntry) + mMaskLength; }
/**
* This method clears the bit corresponding to @p aChannel in ChannelMask.