Crash fix for ESP8266 if mode contains !

This commit is contained in:
Blaz Kristan 2022-08-03 22:27:45 +02:00
parent cdca715afc
commit f45082b764
2 changed files with 4 additions and 2 deletions

View File

@ -313,11 +313,13 @@ uint8_t extractModeSlider(uint8_t mode, uint8_t slider, char *dest, uint8_t maxL
case 4: tmpstr = PSTR("FX Custom 3"); break; case 4: tmpstr = PSTR("FX Custom 3"); break;
default: tmpstr = PSTR("FX Custom"); break; default: tmpstr = PSTR("FX Custom"); break;
} }
strncpy_P(dest, tmpstr, maxLen); // copy the name into buffer (replacing previous)
dest[maxLen-1] = '\0';
} else { } else {
if (nameEnd<0) tmpstr = names.substring(nameBegin).c_str(); // did not find ",", last name? if (nameEnd<0) tmpstr = names.substring(nameBegin).c_str(); // did not find ",", last name?
else tmpstr = names.substring(nameBegin, nameEnd).c_str(); else tmpstr = names.substring(nameBegin, nameEnd).c_str();
strlcpy(dest, tmpstr, maxLen); // copy the name into buffer (replacing previous)
} }
strlcpy(dest, tmpstr, maxLen); // copy the name into buffer (replacing previous)
} }
nameBegin = nameEnd+1; // next name (if "," is not found it will be 0) nameBegin = nameEnd+1; // next name (if "," is not found it will be 0)
} // next slider } // next slider

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // version code in format yymmddb (b = daily build)
#define VERSION 2208032 #define VERSION 2208033
//uncomment this if you have a "my_config.h" file you'd like to use //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG