diff options
author | Christian Kandeler <christian.kandeler@theqtcompany.com> | 2016-01-21 15:10:19 +0100 |
---|---|---|
committer | Alex Blasche <alexander.blasche@theqtcompany.com> | 2016-01-22 16:22:58 +0000 |
commit | 0b0d7ee34f31ddb2028f59e4cdc66fcbc3575ef7 (patch) | |
tree | 3b77a60303aa0fea138d6b2e3f64e39873468009 /src/bluetooth | |
parent | 46d727097c986e6c359291b9ad08ebe1b1b271f0 (diff) |
Bluetooth: Do not assert on remote data.
Otherwise, a malicious device could crash our application.
Change-Id: I427eb1ff88b08710d5c74230f5877b0c59b6fb0f
Reviewed-by: Alex Blasche <alexander.blasche@theqtcompany.com>
Diffstat (limited to 'src/bluetooth')
-rw-r--r-- | src/bluetooth/qlowenergycontroller_bluez.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/bluetooth/qlowenergycontroller_bluez.cpp b/src/bluetooth/qlowenergycontroller_bluez.cpp index 1e0f726e..b37ae4ad 100644 --- a/src/bluetooth/qlowenergycontroller_bluez.cpp +++ b/src/bluetooth/qlowenergycontroller_bluez.cpp @@ -391,7 +391,12 @@ void QLowEnergyControllerPrivate::l2cpReadyRead() break; } - Q_ASSERT(!openRequests.isEmpty()); + if (openRequests.isEmpty()) { + qCWarning(QT_BT_BLUEZ) << "Received unexpected packet from peer, disconnecting."; + disconnectFromDevice(); + return; + } + const Request request = openRequests.dequeue(); processReply(request, reply); |