From c854dd9a9b02233f4eefecaf2bbb5cb5db328f01 Mon Sep 17 00:00:00 2001 From: Crsarmv7l <85343771+Crsarmv7l@users.noreply.github.com> Date: Wed, 8 May 2024 14:26:24 -0400 Subject: [PATCH] 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. --- src/protocols/PhysicalLayer/PhysicalLayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.cpp b/src/protocols/PhysicalLayer/PhysicalLayer.cpp index 7d35056f..234cabab 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.cpp +++ b/src/protocols/PhysicalLayer/PhysicalLayer.cpp @@ -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);