Skip to content

Commit 3c5178e

Browse files
committed
Explicit cast for Coverity CID 416366
1 parent ca38c95 commit 3c5178e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/modbus-tcp.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,8 @@ static int _modbus_tcp_flush(modbus_t *ctx)
525525
}
526526
} while (rc == MODBUS_TCP_MAX_ADU_LENGTH);
527527

528-
return rc_sum;
528+
/* Cast is safe: uint16_t always fits in int, and overflow is checked above */
529+
return (int) rc_sum;
529530
}
530531

531532
/* Listens for any request from one or many modbus masters in TCP */

0 commit comments

Comments
 (0)