mirror of https://github.com/arendst/Tasmota.git
Merge pull request #6646 from s-hadinger/fix_parse
Fix crash when uneven string size
This commit is contained in:
commit
67bbd15612
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue