[coap] fix header length calculation overflow error (#3260)

Credit to OSS-Fuzz.
This commit is contained in:
Jonathan Hui
2018-11-03 08:09:14 -07:00
committed by GitHub
parent 7518eb1fb8
commit 8f25db11cc
+1 -1
View File
@@ -170,7 +170,7 @@ otError Header::FromMessage(const Message &aMessage, uint16_t aMetadataSize)
VerifyOrExit(mHeaderLength + optionLength <= length);
aMessage.Read(offset, optionLength, mHeader.mBytes + mHeaderLength);
mHeaderLength += static_cast<uint8_t>(optionLength);
mHeaderLength += optionLength;
offset += optionLength;
}