summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Rascher <jon@bcat.name>2021-06-16 00:30:27 -0500
committerGitHub <noreply@github.com>2021-06-15 22:30:27 -0700
commitd59f8d1c022234140a94c643f4b78bf5487d39f7 (patch)
tree6ce2749491f3d13752cf299c112a2130de07192f
parentf8d0ea92060d33a23030635c6cd5f24a5926372e (diff)
Fix overrun in st7565_write_raw when not at (0, 0) (#13209)
-rw-r--r--drivers/lcd/st7565.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/lcd/st7565.c b/drivers/lcd/st7565.c
index 4b4891ce71..ee2661a5eb 100644
--- a/drivers/lcd/st7565.c
+++ b/drivers/lcd/st7565.c
@@ -336,8 +336,9 @@ void st7565_write_raw(const char *data, uint16_t size) {
uint16_t cursor_start_index = st7565_cursor - &st7565_buffer[0];
if ((size + cursor_start_index) > ST7565_MATRIX_SIZE) size = ST7565_MATRIX_SIZE - cursor_start_index;
for (uint16_t i = cursor_start_index; i < cursor_start_index + size; i++) {
- if (st7565_buffer[i] == data[i]) continue;
- st7565_buffer[i] = data[i];
+ uint8_t c = *data++;
+ if (st7565_buffer[i] == c) continue;
+ st7565_buffer[i] = c;
st7565_dirty |= ((ST7565_BLOCK_TYPE)1 << (i / ST7565_BLOCK_SIZE));
}
}