From 2dbf0f807bd439a959f04621c6c01e68d9ad1735 Mon Sep 17 00:00:00 2001 From: Gergely Nagy Date: Tue, 24 May 2022 12:29:36 +0200 Subject: [PATCH] DynamicMacros: Do not read past storage_size_ when updating our map When updating our map via Focus, do not read past `storage_size_`, because we do not want to clobber storage space past our slice by accident. Signed-off-by: Gergely Nagy --- .../src/kaleidoscope/plugin/DynamicMacros.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp index c80fd15a..eb0ec223 100644 --- a/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp +++ b/plugins/Kaleidoscope-DynamicMacros/src/kaleidoscope/plugin/DynamicMacros.cpp @@ -272,7 +272,7 @@ EventHandlerResult DynamicMacros::onFocusEvent(const char *command) { } else { uint16_t pos = 0; - while (!::Focus.isEOL()) { + while (!::Focus.isEOL() && pos < storage_size_) { uint8_t b; ::Focus.read(b);