diff options
author | Jonathan Rascher <jon@bcat.name> | 2021-06-16 00:30:37 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-15 22:30:37 -0700 |
commit | 83ee79565ce81c3e8dd097be1fe46dc522e17544 (patch) | |
tree | f5abd7a3eaf62aa0f139647981b3ac013b39628a | |
parent | 5c3991cb90108115a269e0b9f7e4b71019851cc1 (diff) | |
download | qmk_firmware-83ee79565ce81c3e8dd097be1fe46dc522e17544.tar.gz qmk_firmware-83ee79565ce81c3e8dd097be1fe46dc522e17544.zip |
Fix overrun in oled_write_raw when not at (0, 0) (#13204)
-rw-r--r-- | drivers/oled/oled_driver.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/oled/oled_driver.c b/drivers/oled/oled_driver.c index 082115d534..53bdc196dc 100644 --- a/drivers/oled/oled_driver.c +++ b/drivers/oled/oled_driver.c @@ -491,8 +491,9 @@ void oled_write_raw(const char *data, uint16_t size) { uint16_t cursor_start_index = oled_cursor - &oled_buffer[0]; if ((size + cursor_start_index) > OLED_MATRIX_SIZE) size = OLED_MATRIX_SIZE - cursor_start_index; for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) { - if (oled_buffer[i] == data[i]) continue; - oled_buffer[i] = data[i]; + uint8_t c = *data++; + if (oled_buffer[i] == c) continue; + oled_buffer[i] = c; oled_dirty |= ((OLED_BLOCK_TYPE)1 << (i / OLED_BLOCK_SIZE)); } } |