From bcc9e0c55b99395dd2d5861fd7b5199b7a0b03ba Mon Sep 17 00:00:00 2001 From: "Earle F. Philhower, III" Date: Mon, 16 Jul 2018 18:48:17 -0700 Subject: [PATCH] Fix intermittent host tests failure MD5Builder tests have been randomly, non-repeatably failing due to a problem with the returned value of MD5Builder. Valgrind detected a strncpy with an overlapping memory range, which is an undefined operation. Fix it with a memmove instead, and get rid of a couple #define redefinitions which were causing compile warnings on the host side as well. --- cores/esp8266/WCharacter.h | 2 ++ cores/esp8266/WString.cpp | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/cores/esp8266/WCharacter.h b/cores/esp8266/WCharacter.h index f37ddb71c3..884eed037b 100644 --- a/cores/esp8266/WCharacter.h +++ b/cores/esp8266/WCharacter.h @@ -21,7 +21,9 @@ #define Character_h #include +#undef isascii #define isascii(__c) ((unsigned)(__c)<=0177) +#undef toascii #define toascii(__c) ((__c)&0177) // WCharacter.h prototypes diff --git a/cores/esp8266/WString.cpp b/cores/esp8266/WString.cpp index c81b594d6c..4efba3e7d7 100644 --- a/cores/esp8266/WString.cpp +++ b/cores/esp8266/WString.cpp @@ -722,7 +722,7 @@ void String::remove(unsigned int index, unsigned int count) { } char *writeTo = buffer + index; len = len - count; - strncpy(writeTo, buffer + index + count, len - index); + memmove(writeTo, buffer + index + count, len - index); buffer[len] = 0; }