Skip to content

Commit

Permalink
wstring: fix concatenation from flash (#6368)
Browse files Browse the repository at this point in the history
fixes #6367
  • Loading branch information
d-a-v authored and earlephilhower committed Aug 5, 2019
1 parent f78ab66 commit 4e93584
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cores/esp8266/WString.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,12 @@ unsigned char String::concat(const char *cstr, unsigned int length) {
return 1;
if(!reserve(newlen))
return 0;
memmove(wbuffer() + len(), cstr, length + 1);
if (cstr >= wbuffer() && cstr < wbuffer() + len())
// compatible with SSO in ram #6155 (case "x += x.c_str()")
memmove(wbuffer() + len(), cstr, length + 1);
else
// compatible with source in flash #6367
memcpy_P(wbuffer() + len(), cstr, length + 1);
setLen(newlen);
return 1;
}
Expand Down

0 comments on commit 4e93584

Please sign in to comment.