From f2187cc96ee32eb730065153eb37f6adaca4dc93 Mon Sep 17 00:00:00 2001 From: Jordan Galby Date: Tue, 12 Mar 2019 13:53:11 +0100 Subject: [PATCH] OneShot: Fix buffer overflow 51a7537d87fe "OneShot: Fix isPressed() and isSticky()" missed a couple spot. Signed-off-by: Jordan Galby --- src/kaleidoscope/plugin/OneShot.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/kaleidoscope/plugin/OneShot.cpp b/src/kaleidoscope/plugin/OneShot.cpp index d9485221..26a7d788 100644 --- a/src/kaleidoscope/plugin/OneShot.cpp +++ b/src/kaleidoscope/plugin/OneShot.cpp @@ -163,7 +163,7 @@ EventHandlerResult OneShot::onKeyswitchEvent(Key &mapped_key, byte row, byte col } EventHandlerResult OneShot::beforeReportingState() { - for (uint8_t i = 0; i < 8; i++) { + for (uint8_t i = 0; i < ONESHOT_KEY_COUNT / 2; i++) { if (state_[i].active) { activateOneShot(i); } @@ -178,7 +178,7 @@ EventHandlerResult OneShot::afterEachCycle() { bool is_cancelled = false; - for (uint8_t i = 0; i < 32; i++) { + for (uint8_t i = 0; i < ONESHOT_KEY_COUNT; i++) { if (should_cancel_) { if (state_[i].sticky) { if (should_cancel_stickies_) {