mirror of
https://github.com/arendst/Tasmota.git
synced 2025-08-02 15:37:42 +00:00
Fix crash when uneven string size
This commit is contained in:
parent
f5b932a6d5
commit
d593d1d87b
@ -835,7 +835,7 @@ void SerialSendRaw(char *codes)
|
|||||||
|
|
||||||
int size = strlen(codes);
|
int size = strlen(codes);
|
||||||
|
|
||||||
while (size > 0) {
|
while (size > 1) {
|
||||||
strlcpy(stemp, codes, sizeof(stemp));
|
strlcpy(stemp, codes, sizeof(stemp));
|
||||||
code = strtol(stemp, &p, 16);
|
code = strtol(stemp, &p, 16);
|
||||||
Serial.write(code);
|
Serial.write(code);
|
||||||
|
@ -126,7 +126,7 @@ void CmndSSerialSend(void)
|
|||||||
char *codes = RemoveSpace(XdrvMailbox.data);
|
char *codes = RemoveSpace(XdrvMailbox.data);
|
||||||
int size = strlen(XdrvMailbox.data);
|
int size = strlen(XdrvMailbox.data);
|
||||||
|
|
||||||
while (size > 0) {
|
while (size > 1) {
|
||||||
strlcpy(stemp, codes, sizeof(stemp));
|
strlcpy(stemp, codes, sizeof(stemp));
|
||||||
code = strtol(stemp, &p, 16);
|
code = strtol(stemp, &p, 16);
|
||||||
SerialBridgeSerial->write(code); // "AA004566" as hex values
|
SerialBridgeSerial->write(code); // "AA004566" as hex values
|
||||||
|
@ -291,7 +291,7 @@ void CmndZigbeeZNPSend(void)
|
|||||||
|
|
||||||
SBuffer buf((size+1)/2);
|
SBuffer buf((size+1)/2);
|
||||||
|
|
||||||
while (size > 0) {
|
while (size > 1) {
|
||||||
char stemp[3];
|
char stemp[3];
|
||||||
strlcpy(stemp, codes, sizeof(stemp));
|
strlcpy(stemp, codes, sizeof(stemp));
|
||||||
code = strtol(stemp, nullptr, 16);
|
code = strtol(stemp, nullptr, 16);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user