1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-04-22 21:23:07 +03:00

Fix intermittent host tests failure (#4932)

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.
This commit is contained in:
Earle F. Philhower, III 2018-07-16 20:22:55 -07:00 committed by Develo
parent 53091882b8
commit 96a340eb51
2 changed files with 3 additions and 1 deletions

View File

@ -21,7 +21,9 @@
#define Character_h #define Character_h
#include <ctype.h> #include <ctype.h>
#undef isascii
#define isascii(__c) ((unsigned)(__c)<=0177) #define isascii(__c) ((unsigned)(__c)<=0177)
#undef toascii
#define toascii(__c) ((__c)&0177) #define toascii(__c) ((__c)&0177)
// WCharacter.h prototypes // WCharacter.h prototypes

View File

@ -722,7 +722,7 @@ void String::remove(unsigned int index, unsigned int count) {
} }
char *writeTo = buffer + index; char *writeTo = buffer + index;
len = len - count; len = len - count;
strncpy(writeTo, buffer + index + count, len - index); memmove(writeTo, buffer + index + count, len - index);
buffer[len] = 0; buffer[len] = 0;
} }