Skip to content

Commit

Permalink
oappend robustness improvement
Browse files Browse the repository at this point in the history
obuf is reset to nullptr in some cases
  • Loading branch information
softhack007 authored and DedeHai committed Jan 27, 2024
1 parent 126b238 commit 63c766a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion wled00/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ bool oappendi(int i)
bool oappend(const char* txt)
{
uint16_t len = strlen(txt);
if (olen + len >= SETTINGS_STACK_BUF_SIZE) {
if ((obuf == nullptr) || (olen + len >= SETTINGS_STACK_BUF_SIZE)) { // sanity checks
#ifdef WLED_DEBUG
DEBUG_PRINT(F("oappend() buffer overflow. Cannot append "));
DEBUG_PRINT(len); DEBUG_PRINT(F(" bytes \t\""));
Expand Down

0 comments on commit 63c766a

Please sign in to comment.