-
Notifications
You must be signed in to change notification settings - Fork 10
Description
Hi. I was reading your library to see how it works and I've foud what I think it's an error, tell me if I'm right.
You declare buffOut as an array of uint8_t and size MAX_BUFFER which is 64 (bytes).
When a client requests a function 3 read, you have to fill the buffOut array with the user data (width writeRegisterToBuffer). What I don't get, in the modbus protocol, the "length" is specified in registers (16 bits = uint16_t) but when you performe the "sanity" check you compare it againts MAX_BUFFER which is specified in bytes. So, if a modbus requests asks for address 0 length 64. You will need a buffer of 128 bytes (+ modbus header) to return the answer. If you compare against MAX_BUFFER it will return that it's OK to proceed but it is not!
Thanks