From 35e0ad2ad1c8ce4ad6cf9e95936e392a0e6205ce Mon Sep 17 00:00:00 2001 From: David Gauchard Date: Thu, 1 Aug 2019 11:43:59 +0200 Subject: [PATCH] wstring: fix concatenation from flash fixes #6367 --- cores/esp8266/WString.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cores/esp8266/WString.cpp b/cores/esp8266/WString.cpp index 02307eeacb..aee4b1c94b 100644 --- a/cores/esp8266/WString.cpp +++ b/cores/esp8266/WString.cpp @@ -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; }