Skip to content

Commit 2468f48

Browse files
committed
Prevent buffer overrun internally
1 parent ea22ed8 commit 2468f48

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/MainClasses/ANTPLUS_AntPlusRouter.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@ void AntPlusRouter::setAntPlusNetworkKey(const uint8_t* key) {
6464

6565
void AntPlusRouter::setProfile(uint8_t channel, BaseProfile* profile) {
6666
// restrict user to maximum number of channels
67-
// channel = min(channel, _maxChannels - 1); TODO, wait till we set this
67+
if (channel >= ANTPLUS_MAX_CHANNELS_POSSIBLE)
68+
return;
6869
// TODO close channel to make sure it hasn't been randomly replaced
6970
_profiles[channel] = profile;
7071
profile->setRouter(this);

0 commit comments

Comments
 (0)