Skip to content

Commit

Permalink
Fix buffer overrun in showString() (#224)
Browse files Browse the repository at this point in the history
Found a crash by sending a too-long string via MQTT.

I assume the check in `showString()` was just forgotten, rather than
intentional.
  • Loading branch information
kitlaan authored Oct 6, 2024
1 parent e1eb9b9 commit 8db0a90
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion arduino/splitflap/esp32/core/splitflap_task.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ void SplitflapTask::log(const char* msg) {
void SplitflapTask::showString(const char* str, uint8_t length, bool force_full_rotation) {
Command command = {};
command.command_type = CommandType::MODULES;
for (uint8_t i = 0; i < length; i++) {
for (uint8_t i = 0; i < length && i < NUM_MODULES; i++) {
int8_t index = findFlapIndex(str[i]);
if (index != -1) {
if (force_full_rotation || index != modules[i]->GetTargetFlapIndex()) {
Expand Down

0 comments on commit 8db0a90

Please sign in to comment.