Skip to content

Commit

Permalink
Darwin BLE: fix length check in advertisement data (#8112)
Browse files Browse the repository at this point in the history
  • Loading branch information
bluebin14 authored Jul 7, 2021
1 parent 1a51e36 commit 491f5f4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/platform/Darwin/BleConnectionDelegateImpl.mm
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ - (void)centralManager:(CBCentralManager *)central
NSData * serviceData = [servicesData objectForKey:serviceUUID];

NSUInteger length = [serviceData length];
if (length == 7) {
if (length >= 7) {
const uint8_t * bytes = (const uint8_t *) [serviceData bytes];
uint8_t opCode = bytes[0];
uint16_t discriminator = (bytes[1] | (bytes[2] << 8)) & 0xfff;
Expand Down

0 comments on commit 491f5f4

Please sign in to comment.