diff options
author | Alex Blasche <alexander.blasche@digia.com> | 2014-09-26 14:18:20 +0200 |
---|---|---|
committer | Alex Blasche <alexander.blasche@digia.com> | 2014-09-26 15:16:36 +0200 |
commit | 5a6e5dc44ba4718662eb27123d8cb4273b369adf (patch) | |
tree | 814b6e2b35faf30d26bc379054a248597a7a8307 | |
parent | b32a8ffc58ded44c34da6baae63898f1e4f95808 (diff) |
Don't permit write of non-existing or empty data via socket
Change-Id: Ic8387dd411a9784b6163a15d423cdeaa5e63ea30
Reviewed-by: Timur Pocheptsov <Timur.Pocheptsov@digia.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r-- | src/bluetooth/qbluetoothsocket.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/bluetooth/qbluetoothsocket.cpp b/src/bluetooth/qbluetoothsocket.cpp index f1e5568e..be099622 100644 --- a/src/bluetooth/qbluetoothsocket.cpp +++ b/src/bluetooth/qbluetoothsocket.cpp @@ -648,6 +648,13 @@ quint16 QBluetoothSocket::peerPort() const qint64 QBluetoothSocket::writeData(const char *data, qint64 maxSize) { Q_D(QBluetoothSocket); + + if (!data || maxSize <= 0) { + d_ptr->errorString = tr("Invalid data/data size"); + setSocketError(QBluetoothSocket::OperationError); + return -1; + } + return d->writeData(data, maxSize); } |