You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wanted to learn more about the MODBUS TCP protocol and found this library and started reading the sources to get a better understanding. I came across this in the tcpTransporter.Send() method:
Unless I'm not seeing it right: After io.ReadFull, data has 7 bytes populated, remaining 253 bytes are 0x00. Decoding it with data[4:] practically passes 3 populated bytes.
This will result in length to contain a larger value if the device ID is non zero. This could then lead to a false positive on the length error check further down the code.
Also, the aduResponse might end up being longer. This wouldn't be a problem if the PDU unpacking takes proper precautions on lengths, haven't checked.
I'm not actually using this project, so I'm not able to confirm if this an actual bug and I might be completely wrong about my assumption. Just trying to learn new things :D.
The text was updated successfully, but these errors were encountered:
I wanted to learn more about the MODBUS TCP protocol and found this library and started reading the sources to get a better understanding. I came across this in the
tcpTransporter.Send()
method:modbus/tcpclient.go
Lines 173 to 178 in 606c02f
Where:
modbus/tcpclient.go
Lines 22 to 23 in 606c02f
Unless I'm not seeing it right: After
io.ReadFull
,data
has 7 bytes populated, remaining 253 bytes are0x00
. Decoding it withdata[4:]
practically passes 3 populated bytes.This will result in
length
to contain a larger value if the device ID is non zero. This could then lead to a false positive on thelength
error check further down the code.Also, the
aduResponse
might end up being longer. This wouldn't be a problem if the PDU unpacking takes proper precautions on lengths, haven't checked.modbus/tcpclient.go
Line 194 in 606c02f
I'm not actually using this project, so I'm not able to confirm if this an actual bug and I might be completely wrong about my assumption. Just trying to learn new things :D.
The text was updated successfully, but these errors were encountered: