Modbus: Fail fast on an invalid MBAP length field in the TCP client


The client had the same missing lower-bound check, but computed the ADU
size into an int, so nothing truncated: it simply waited for the 65542
bytes the length field claims. The transaction stalls until the response
timeout while the partial frame is buffered, and a peer that keeps
sending grows that buffer to 64 KiB before a single byte is parsed.

Call the shared validation added in the preceding commit. A bad length
field now surfaces as an immediate protocol error and an aborted reply
instead of a stall until the response timeout.

Patch created with the help of Claude Opus 5, based on a deep-scan that
got concluded on this repository. Verified and corrected by myself.

Fixes: QTBUG-149969
Pick-to: 6.12 6.12.0 6.11 6.11.3 6.10 6.8
Change-Id: Ia602fe40d05a0957d2d06f53f3c496e9167b3b13
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
commit925ea4904e3941302c828b1818512958a5d50433
parenta6f6aff01452ef4b630336f448ad897e70e6068d
authorDennis Oberst <dennis.oberst@qt.io>
committerDennis Oberst <dennis.oberst@qt.io>
commit timeMon, 14 Sep 2026 13:23:36 +0000