From a1ff19d2d4fb5bf357e28b6e5b25417568d27115 Mon Sep 17 00:00:00 2001 From: Carlos Duclos Date: Sat, 4 Aug 2018 00:42:08 -0500 Subject: [PATCH] #33 Fixed remoteNameRequest validation --- Sources/BluetoothLinux/DeviceRequest.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/BluetoothLinux/DeviceRequest.swift b/Sources/BluetoothLinux/DeviceRequest.swift index e7d527c..42170c3 100644 --- a/Sources/BluetoothLinux/DeviceRequest.swift +++ b/Sources/BluetoothLinux/DeviceRequest.swift @@ -385,12 +385,12 @@ internal func HCISendRequest (_ deviceDescriptor: CInt, else { fatalError("HCI Command 'RemoteNameRequest' was sent, but the event parameter data does not correspond to 'RemoteNameRequestParameter'") } // must be different, for some reason - guard commandParameter.address != parameter.address else { continue } + guard commandParameter.address == parameter.address else { continue } } // success! try done() - let dataLength = min(eventData.count - 1, eventParameterLength) + let dataLength = min(eventData.count, eventParameterLength) return Data(eventData.suffix(dataLength)) case .lowEnergyMeta: