We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents de885b0 + 3f6af80 commit d309634Copy full SHA for d309634
source/application/luaport.c
@@ -39,6 +39,13 @@ static volatile char repl_buffer[BLE_PREFERRED_MAX_MTU];
39
40
void lua_write_to_repl(uint8_t *buffer, uint8_t length)
41
{
42
+ // Bounds check to prevent buffer overflow (CVE-PENDING)
43
+ // Buffer size is BLE_PREFERRED_MAX_MTU (247), length can be 0-255
44
+ if (length >= BLE_PREFERRED_MAX_MTU)
45
+ {
46
+ length = BLE_PREFERRED_MAX_MTU - 1; // Reserve space for null terminator
47
+ }
48
+
49
// Loop copy because memcpy isn't compatible with volatile
50
for (size_t buffer_index = 0; buffer_index < length; buffer_index++)
51
0 commit comments