From 5081cfb891ed1a1a2841e4a99cd450833dccde17 Mon Sep 17 00:00:00 2001 From: Ewoud Date: Mon, 29 May 2023 18:33:49 +0200 Subject: [PATCH] Bug fix, allocate string to store ledmap name --- wled00/FX_fcn.cpp | 10 +++++++--- wled00/wled.h | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/wled00/FX_fcn.cpp b/wled00/FX_fcn.cpp index c5a5509d..e9416920 100644 --- a/wled00/FX_fcn.cpp +++ b/wled00/FX_fcn.cpp @@ -1364,7 +1364,8 @@ void WS2812FX::enumerateLedmaps() { f = WLED_FS.open(fileName, "r"); if (f) { f.find("\"n\":"); - const char *name = f.readStringUntil('\n').c_str(); + char name[33]; + f.readBytesUntil('\n', name, sizeof(name)); USER_PRINTF("enumerateLedmaps %s %s\n", fileName, name); size_t len = 0; @@ -2139,10 +2140,13 @@ bool WS2812FX::deserializeMap(uint8_t n) { //WLEDMM: read width and height (mandatory in file!!) f.find("\"width\":"); - uint16_t maxWidth = f.readStringUntil('\n').toInt(); + f.readBytesUntil('\n', fileName, sizeof(fileName)); //hack: use fileName as we have this allocated already + uint16_t maxWidth = atoi(fileName); + f.find("\"height\":"); - uint16_t maxHeight = f.readStringUntil('\n').toInt(); + f.readBytesUntil('\n', fileName, sizeof(fileName)); + uint16_t maxHeight = atoi(fileName); USER_PRINTF("deserializeMap %d x %d\n", maxWidth, maxHeight); if (maxWidth * maxHeight <= 0) { diff --git a/wled00/wled.h b/wled00/wled.h index c0b9abe7..447f9a6b 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2305260 +#define VERSION 2305290 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG