Fix crash when uneven string size

This commit is contained in:
Stephan Hadinger 2019-10-15 08:27:32 +02:00
parent f5b932a6d5
commit d593d1d87b
3 changed files with 3 additions and 3 deletions

View File

@ -835,7 +835,7 @@ void SerialSendRaw(char *codes)
int size = strlen(codes);
while (size > 0) {
while (size > 1) {
strlcpy(stemp, codes, sizeof(stemp));
code = strtol(stemp, &p, 16);
Serial.write(code);

View File

@ -126,7 +126,7 @@ void CmndSSerialSend(void)
char *codes = RemoveSpace(XdrvMailbox.data);
int size = strlen(XdrvMailbox.data);
while (size > 0) {
while (size > 1) {
strlcpy(stemp, codes, sizeof(stemp));
code = strtol(stemp, &p, 16);
SerialBridgeSerial->write(code); // "AA004566" as hex values

View File

@ -291,7 +291,7 @@ void CmndZigbeeZNPSend(void)
SBuffer buf((size+1)/2);
while (size > 0) {
while (size > 1) {
char stemp[3];
strlcpy(stemp, codes, sizeof(stemp));
code = strtol(stemp, nullptr, 16);