andresarmento / modbus-esp8266

A library that allows your ESP8266 to communicate via Modbus protocol, acting as a slave (master in development). Supports IP via wireless network (Modbus IP).
BSD 3-Clause "New" or "Revised" License
146 stars 236 forks source link

Critical Fix. Buffer overflow caused random device reboot or hang. Malloc result checking in addReg and exceptionalResponce. Wrong value for every 8-th reg in read/writeCoils, readInputStats. #11

Open emelianov opened 6 years ago

emelianov commented 6 years ago

With some devices Modbus IP packet size is grater than specified in header. So count of bytes to read should be limited by buffer size not packet size from header.

emelianov commented 6 years ago

addReg and exceptionalResponce needs to be extended with malloc() result checking.

emelianov commented 6 years ago

Fix wrong value for every 8-th reg in read/writeCoils, readInputStats