Subtract 1 from RADIOLIB_STATIC_ARRAY_SIZE

STATIC_ARRAY_SIZE is by default 256, bufferWritePos is uint8_t which has a max value of 255.

The greater than is not really needed in this check.
This commit is contained in:
Crsarmv7l 2024-05-08 14:26:24 -04:00 committed by GitHub
parent 7b348fae33
commit c854dd9a9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -435,7 +435,7 @@ void PhysicalLayer::updateDirectBuffer(uint8_t bit) {
// check complete byte
if(this->bufferBitPos == 8) {
if(this->bufferWritePos >= RADIOLIB_STATIC_ARRAY_SIZE) {
if(this->bufferWritePos >= RADIOLIB_STATIC_ARRAY_SIZE -1) {
this->bufferWritePos = 0;
}
this->buffer[this->bufferWritePos] = Module::reflect(this->byteBuff, 8);