Fix size inconsistencies in QBluetoothSocketPrivateDarwin::writeData()


The reserve() call truncated the passed qint64 to int, but later
std::copy() was passing the unmodified qint64 value to determine the
end of the data to copy. That could lead to writing past the end of
the allocated buffer if the user tried to write more than INT_MAX bytes
to the socket.

Fix by introducing a temporary variable that truncates the qint64 value
to int, and use it consistently (and also as a return value).

Not using qsizetype, because all other code here truncates to int.
Changing to qsizetype should be done consistently in a separate commit.

Amends c1286c3a344593c79feced5c782ff85bca80bfff.

Pick-to: 6.9 6.8 6.5
Change-Id: I38a6dee1707b124d662b815938f33a39e1badb00
Reviewed-by: Juha Vuolle <juha.vuolle@qt.io>
commit8c7298dc51210ea8c827269083136d77b01a46c9
parentd65347f834ff94ba08edd90c53d100d22f70da11
authorIvan Solovev <ivan.solovev@qt.io>
committerIvan Solovev <ivan.solovev@qt.io>
commit timeThu, 22 May 2025 17:46:13 +0200