Add check to avoid buffer overflow on progmem2char

transfer is limited to 300 char string, if over, string is ignored
This commit is contained in:
Luc 2015-07-25 20:25:07 +08:00
parent b7e6804e24
commit bcf2eb0e69

View File

@ -332,7 +332,8 @@ const char POLLING_ID[]PROGMEM ="POLLING";
char * progmem2char(const char* src)
{
static char buffer[300];
strcpy_P(buffer,src);
buffer[0]=0;
if(strlen_P(src)<299)strcpy_P(buffer,src);
return buffer;
}