From 480bfbd0217ce349d6c129ec35c058f8b9b6cdb4 Mon Sep 17 00:00:00 2001 From: "James N. V. Cash" Date: Fri, 27 Oct 2017 17:28:32 -0400 Subject: [PATCH] Guard against out-of-bounds layer --- src/Kaleidoscope/EEPROM-Keymap.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Kaleidoscope/EEPROM-Keymap.cpp b/src/Kaleidoscope/EEPROM-Keymap.cpp index 7d83e792..0d2b00c6 100644 --- a/src/Kaleidoscope/EEPROM-Keymap.cpp +++ b/src/Kaleidoscope/EEPROM-Keymap.cpp @@ -113,6 +113,9 @@ bool EEPROMKeymap::focusKeymapLayer(const char *command) { } uint8_t layer = Serial.parseInt(); + if (layer >= max_layers_) { + return false; + } uint16_t keysPerLayer = ROWS * COLS; uint16_t offset = layer * keysPerLayer; if (Serial.peek() == '\n') {