From 5bdc33bc9535d463299ab9f443b7b511cff004f3 Mon Sep 17 00:00:00 2001 From: Drath Date: Thu, 11 Sep 2025 18:22:41 +0200 Subject: [PATCH] sanity check --- src/LCDDisplay.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/LCDDisplay.cpp b/src/LCDDisplay.cpp index 14e5bf1..86db08b 100644 --- a/src/LCDDisplay.cpp +++ b/src/LCDDisplay.cpp @@ -80,8 +80,8 @@ void LCDDisplay::writeLines(std::array lines) { /* writes string to line buffer at given pos*/ void LCDDisplay::writeBuf(uint8_t row, uint8_t col, std::string str) { - // size_t max_copy = std::min(str.size(), sizeof(linebuf[row]) - col - 1); - std::memcpy(&linebuf[row][col], str.c_str(), str.size()); // will overflow + size_t len = std::min(str.size(), sizeof(linebuf[row]) - col); + std::memcpy(&linebuf[row][col], str.c_str(), len); // will overflow } /* hyper optimized buffer flush command, writes whole disp with a single write */