diff --git a/README.md b/README.md index eebf54c..b99b350 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,10 @@ This library is now complete, the remaining work is mainly maintenance and bug f # Change Log +**V1.1.6 2024.2.25** + ++ Fix the bug of the pkg's length may longer than maximum(without head, tail and pkg length, it's 63 Bytes). + **V1.1.5 2024.2.23** + Fix the bug of the pack vector may be accessed out of range. diff --git a/library.properties b/library.properties index 9a4cd07..06e57ae 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name= DLLN3X ZigBee Mesh Module Library -version= 1.1.5 +version= 1.1.6 author= Dylan Liu maintainer= Dylan Liu sentence= This library allows you to use DLLN3X ZigBee mesh module very easily. diff --git a/src/DLLN3X.cpp b/src/DLLN3X.cpp index 2da8033..b05bd64 100644 --- a/src/DLLN3X.cpp +++ b/src/DLLN3X.cpp @@ -68,16 +68,17 @@ ZigbeeFrame DLLN3X::recv(bool non_blocked) bool DLLN3X::send(ZigbeeFrame zf) { bool status = false; - if (zf.getSrcPort() < 0x80) + uint8_t len = zf.size(); + if (zf.getSrcPort() < 0x80 || len > 66) return false; - status = _DSerial->write(zf.data(),zf.size()); + status = _DSerial->write(zf.data(), len); return status; } bool DLLN3X::send_cmd(uint8_t des_port, uint8_t arg, uint8_t* data, uint8_t data_length) { ZigbeeFrame zf(0x80, des_port, 0x0000); - if (data_length - 4 > 63 - 1) + if (data_length + 4 > 63) return false; zf.append(arg); zf.addData(data, data_length);