Repository navigation
Conversation
_modbus_receive_msg() passes the same timeval to every select() call and relies on select() to decrement it. Only Linux does that. On Windows, macOS and the BSDs the full timeout starts again after each received byte, so when the byte timeout is disabled a peer sending one byte just before each expiry keeps the receive going for as long as it wants (CVE-2026-51539). The response or indication timeout now sets an absolute deadline on a monotonic clock, and each select() gets the time left. When the byte timeout is enabled nothing changes: it takes over after the first byte as before. Fixes stephane#843
|
We require contributors to sign our Contributor License Agreement. In order for us to review and merge your code, please fill https://forms.gle/5635zjphDo5JEJQSA to get added. Your document will be manually checked by the maintainer. Be patient... |
|
This affects clients too, not only servers. When the byte timeout is disabled, the Test with v3.2.0 (on Windows 11 x64, MSVC 2022, with the The Win32 RTU backend has the same problem. We build 3.2.0 with an equivalent change for confirmations: a deadline from |
_modbus_receive_msg() passes the same timeval to every select() call and relies on select() to decrement it. Only Linux does that. On Windows, macOS and the BSDs the full timeout starts again after each received byte, so when the byte timeout is disabled a peer sending one byte just before each expiry keeps the receive going for as long as it wants (CVE-2026-51539).
The response or indication timeout now sets an absolute deadline on a monotonic clock, and each select() gets the time left. When the byte timeout is enabled nothing changes: it takes over after the first byte as before.
Fixes #843