Closed Fehlerteufel31 closed 4 months ago
Hi, sorry for replying two months later. I wrote that code a long ago, so I'm not entirely sure, but I think it should be correct because REGS_ADDR_MAX
is the maximum addressable data address, so for example if the client requested 3 registers starting from address 0 and our REGS_ADDR_MAX is 2 (so we expose addresses 0,1 and 2), the request is valid having quantity
= REGS_ADDR_MAX
+1
Hi,
I don't understand why there is
+1
in this if statement. It looks to me like the following arrayserver_registers
can be accessed out of bounds ifquantity
= REGS_ADDR_MAX+1 https://github.com/debevv/nanoMODBUS/blob/0642bbb1dee018b8df5400dce9e38e91028964ec/examples/arduino/server-rtu/server-rtu.ino#L73-L80