From 7b348fae33f26da14316cccf7be6213666bfb724 Mon Sep 17 00:00:00 2001 From: Crsarmv7l <85343771+Crsarmv7l@users.noreply.github.com> Date: Sun, 5 May 2024 16:15:28 -0400 Subject: [PATCH] Check bufferWritePos if too large set to 0 --- src/protocols/PhysicalLayer/PhysicalLayer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/protocols/PhysicalLayer/PhysicalLayer.cpp b/src/protocols/PhysicalLayer/PhysicalLayer.cpp index 70464ba7..7d35056f 100644 --- a/src/protocols/PhysicalLayer/PhysicalLayer.cpp +++ b/src/protocols/PhysicalLayer/PhysicalLayer.cpp @@ -435,6 +435,9 @@ void PhysicalLayer::updateDirectBuffer(uint8_t bit) { // check complete byte if(this->bufferBitPos == 8) { + if(this->bufferWritePos >= RADIOLIB_STATIC_ARRAY_SIZE) { + this->bufferWritePos = 0; + } this->buffer[this->bufferWritePos] = Module::reflect(this->byteBuff, 8); RADIOLIB_DEBUG_PROTOCOL_PRINTLN("R\t%X", this->byteBuff);