Skip to content

Commit 5852b90

Browse files
committed
Fix CID 561619 - Remove dead code
1 parent dd235f1 commit 5852b90

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/modbus.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,11 +1337,9 @@ int modbus_proxy(modbus_t *frontend_ctx,
13371337

13381338
/* Build a raw request for the backend from the PDU.
13391339
The raw request for modbus_send_raw_request is: slave + function + data
1340-
(ie. the PDU from the frontend request, starting at header_length - 1). */
1341-
if (pdu_length + 1 > MAX_MESSAGE_LENGTH) {
1342-
errno = EMBBADDATA;
1343-
return -1;
1344-
}
1340+
(ie. the PDU from the frontend request, starting at header_length - 1).
1341+
pdu_length is bounded above by the check on MODBUS_MAX_PDU_LENGTH, so
1342+
pdu_length + 1 always fits in backend_req[MAX_MESSAGE_LENGTH]. */
13451343
memcpy(backend_req, req + frontend_header_length - 1, pdu_length + 1);
13461344
backend_req_length = pdu_length + 1;
13471345

0 commit comments

Comments
 (0)