Skip to content

Commit 5784092

Browse files
authored
Fix settings JS buffer too small (wled#2323)
1 parent d6ad089 commit 5784092

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

wled00/const.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,11 @@
265265
#endif
266266

267267
// string temp buffer (now stored in stack locally)
268-
#define OMAX 2048
268+
#ifdef ESP8266
269+
#define SETTINGS_STACK_BUF_SIZE 2048
270+
#else
271+
#define SETTINGS_STACK_BUF_SIZE 3096
272+
#endif
269273

270274
#ifdef WLED_USE_ETHERNET
271275
#define E131_MAX_UNIVERSE_COUNT 20

wled00/wled.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bool oappendi(int i)
4242
bool oappend(const char* txt)
4343
{
4444
uint16_t len = strlen(txt);
45-
if (olen + len >= OMAX)
45+
if (olen + len >= SETTINGS_STACK_BUF_SIZE)
4646
return false; // buffer full
4747
strcpy(obuf + olen, txt);
4848
olen += len;

wled00/wled_server.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -362,9 +362,10 @@ void serveMessage(AsyncWebServerRequest* request, uint16_t code, const String& h
362362
String settingsProcessor(const String& var)
363363
{
364364
if (var == "CSS") {
365-
char buf[2048];
365+
char buf[SETTINGS_STACK_BUF_SIZE];
366366
buf[0] = 0;
367367
getSettingsJS(optionType, buf);
368+
//Serial.println(uxTaskGetStackHighWaterMark(NULL));
368369
return String(buf);
369370
}
370371

0 commit comments

Comments
 (0)