From b2578703b2234d907c79968cf7fd706537f7a91a Mon Sep 17 00:00:00 2001 From: Damian Schneider Date: Mon, 29 Dec 2025 12:56:06 +0100 Subject: [PATCH] minor bugfixes as suggested by the rabbit - PulLightControl UM: dont release a lock you do not own - off-by-one error in extractModeSlider (used only in rotary in UM) - safety check in playlist in case something goes horribly wrong --- wled00/playlist.cpp | 3 ++- wled00/util.cpp | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wled00/playlist.cpp b/wled00/playlist.cpp index 463f2b15..b98f93c6 100644 --- a/wled00/playlist.cpp +++ b/wled00/playlist.cpp @@ -90,7 +90,8 @@ int16_t loadPlaylist(JsonObject playlistObj, byte presetId) { it++; } } - for (int i = it; i < playlistLen; i++) playlistEntries[i].dur = playlistEntries[it -1].dur; + if (it > 0) // should never happen but just in case + for (int i = it; i < playlistLen; i++) playlistEntries[i].dur = playlistEntries[it -1].dur; it = 0; JsonArray tr = playlistObj[F("transition")]; diff --git a/wled00/util.cpp b/wled00/util.cpp index 63e8b131..d075efa1 100644 --- a/wled00/util.cpp +++ b/wled00/util.cpp @@ -378,7 +378,7 @@ uint8_t extractModeSlider(uint8_t mode, uint8_t slider, char *dest, uint8_t maxL case 0: strncpy_P(dest, PSTR("FX Speed"), maxLen); break; case 1: strncpy_P(dest, PSTR("FX Intensity"), maxLen); break; } - dest[maxLen] = '\0'; // strncpy does not necessarily null terminate string + dest[maxLen-1] = '\0'; // strncpy does not necessarily null terminate string } } return strlen(dest);