diff --git a/sonoff/support.ino b/sonoff/support.ino index 33841cc26..bb6a6aa72 100644 --- a/sonoff/support.ino +++ b/sonoff/support.ino @@ -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); diff --git a/sonoff/xdrv_08_serial_bridge.ino b/sonoff/xdrv_08_serial_bridge.ino index 8a0543858..2604bfebf 100644 --- a/sonoff/xdrv_08_serial_bridge.ino +++ b/sonoff/xdrv_08_serial_bridge.ino @@ -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 diff --git a/sonoff/xdrv_23_zigbee_9_impl.ino b/sonoff/xdrv_23_zigbee_9_impl.ino index 69ae1d12b..32d1e8885 100644 --- a/sonoff/xdrv_23_zigbee_9_impl.ino +++ b/sonoff/xdrv_23_zigbee_9_impl.ino @@ -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);