Skip to content

Commit c7cfcdd

Browse files
fix potential arrary overflow problem of _recvBuffer
1 parent 14596d4 commit c7cfcdd

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

src/utility/HCI.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,15 @@ void HCIClass::poll(unsigned long timeout)
112112

113113
while (HCITransport.available()) {
114114
byte b = HCITransport.read();
115+
116+
if (sizeof(_recvBuffer) <= _recvIndex)
117+
{
118+
_recvIndex = 0;
119+
if (_debug) {
120+
_debug->println("_recvBuffer overflow");
121+
}
122+
continue;
123+
}
115124

116125
_recvBuffer[_recvIndex++] = b;
117126

0 commit comments

Comments
 (0)