From dd99642cf78c0d5adcd2c29305d7dabb7e51be2d Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Thu, 14 Nov 2024 08:24:20 +0100 Subject: [PATCH] Prevent crashing when `display.ini` is missing end `#` (#22471) --- CHANGELOG.md | 1 + lib/lib_display/UDisplay/uDisplay.cpp | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e544314cc..b6bcfcdea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. ### Fixed - Matter provisioning with matter.js controller (#22470) +- Prevent crashing when `display.ini` is missing end `#` ### Removed diff --git a/lib/lib_display/UDisplay/uDisplay.cpp b/lib/lib_display/UDisplay/uDisplay.cpp index 4af702125..96b59e3dd 100755 --- a/lib/lib_display/UDisplay/uDisplay.cpp +++ b/lib/lib_display/UDisplay/uDisplay.cpp @@ -680,14 +680,15 @@ uDisplay::uDisplay(char *lp) : Renderer(800, 600) { if (*lp == '\n' || *lp == ' ') { // Add space char lp++; } else { - lp = strchr(lp, '\n'); - if (!lp) { - lp = strchr(lp, ' '); - if (!lp) { + char *lp1; + lp1 = strchr(lp, '\n'); + if (!lp1) { + lp1 = strchr(lp, ' '); + if (!lp1) { break; } } - lp++; + lp = lp1 + 1; } }