summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@theqtcompany.com>2016-01-21 15:10:19 +0100
committerAlex Blasche <alexander.blasche@theqtcompany.com>2016-01-22 16:22:58 +0000
commit0b0d7ee34f31ddb2028f59e4cdc66fcbc3575ef7 (patch)
tree3b77a60303aa0fea138d6b2e3f64e39873468009
parent46d727097c986e6c359291b9ad08ebe1b1b271f0 (diff)
downloadqtconnectivity-0b0d7ee34f31ddb2028f59e4cdc66fcbc3575ef7.tar.gz
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>
-rw-r--r--src/bluetooth/qlowenergycontroller_bluez.cpp7
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);