[coap] change assert to avoid index out-of-bounds warning (#3464)

This commit is contained in:
Jonathan Hui
2019-01-17 02:52:37 -08:00
committed by GitHub
parent 28582ef038
commit b268171278
+3 -2
View File
@@ -317,8 +317,9 @@ otError Message::ParseHeader(void)
{
otError error = OT_ERROR_NONE;
assert(mBuffer.mHead.mData + mBuffer.mHead.mInfo.mReserved >=
reinterpret_cast<uint8_t *>(&GetHelpData()) + sizeof(GetHelpData()));
assert(mBuffer.mHead.mInfo.mReserved >=
sizeof(GetHelpData()) +
static_cast<size_t>((reinterpret_cast<uint8_t *>(&GetHelpData()) - mBuffer.mHead.mData)));
memset(&GetHelpData(), 0, sizeof(GetHelpData()));