Skip to content

Incorrect sanity check? #4

Description

@gonzabrusco

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions