[meshcop] avoid shift exponent too large in ChannelTlv processing (#3673)

This commit is contained in:
Jonathan Hui
2019-03-12 10:47:25 -07:00
committed by GitHub
parent e82531507b
commit 950c7c8612
2 changed files with 2 additions and 0 deletions
+1
View File
@@ -87,6 +87,7 @@ enum
OT_RADIO_CHANNEL_PAGE_0_MASK = (1U << OT_RADIO_CHANNEL_PAGE_0), ///< 2.4 GHz IEEE 802.15.4-2006
OT_RADIO_CHANNEL_PAGE_2 = 2, ///< 915 MHz IEEE 802.15.4-2006
OT_RADIO_CHANNEL_PAGE_2_MASK = (1U << OT_RADIO_CHANNEL_PAGE_2), ///< 915 MHz IEEE 802.15.4-2006
OT_RADIO_CHANNEL_PAGE_MAX = OT_RADIO_CHANNEL_PAGE_2, ///< Maximum supported channel page value
};
/**
+1
View File
@@ -120,6 +120,7 @@ bool ChannelTlv::IsValid(void) const
bool ret = false;
VerifyOrExit(GetLength() == sizeof(*this) - sizeof(Tlv));
VerifyOrExit(mChannelPage <= OT_RADIO_CHANNEL_PAGE_MAX);
VerifyOrExit((1U << mChannelPage) & Phy::kSupportedChannelPages);
VerifyOrExit(Phy::kChannelMin <= GetChannel() && GetChannel() <= Phy::kChannelMax);
ret = true;