Skip to content

Commit bcc9e0c

Browse files
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.
1 parent e6af980 commit bcc9e0c

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

cores/esp8266/WCharacter.h

+2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
#define Character_h
2222

2323
#include <ctype.h>
24+
#undef isascii
2425
#define isascii(__c) ((unsigned)(__c)<=0177)
26+
#undef toascii
2527
#define toascii(__c) ((__c)&0177)
2628

2729
// WCharacter.h prototypes

cores/esp8266/WString.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ void String::remove(unsigned int index, unsigned int count) {
722722
}
723723
char *writeTo = buffer + index;
724724
len = len - count;
725-
strncpy(writeTo, buffer + index + count, len - index);
725+
memmove(writeTo, buffer + index + count, len - index);
726726
buffer[len] = 0;
727727
}
728728

0 commit comments

Comments
 (0)