Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed calls to getBytes to specify the length (for safety) #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions BLEFramework/BLE/BLE.m
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

/*

BLE framework source code is placed under the MIT license
BLE framework source code is placed under the MIT license

Copyright (c) 2013 RedBearLab

Expand Down Expand Up @@ -309,8 +309,8 @@ -(int) compareCBUUID:(CBUUID *) UUID1 UUID2:(CBUUID *)UUID2
{
char b1[16];
char b2[16];
[UUID1.data getBytes:b1];
[UUID2.data getBytes:b2];
[UUID1.data getBytes:b1 length:16];
[UUID2.data getBytes:b2 length:16];

if (memcmp(b1, b2, UUID1.data.length) == 0)
return 1;
Expand All @@ -322,7 +322,7 @@ -(int) compareCBUUIDToInt:(CBUUID *)UUID1 UUID2:(UInt16)UUID2
{
char b1[16];

[UUID1.data getBytes:b1];
[UUID1.data getBytes:b1 length:16];
UInt16 b2 = [self swap:UUID2];

if (memcmp(b1, (char *)&b2, 2) == 0)
Expand All @@ -334,7 +334,7 @@ -(int) compareCBUUIDToInt:(CBUUID *)UUID1 UUID2:(UInt16)UUID2
-(UInt16) CBUUIDToInt:(CBUUID *) UUID
{
char b1[16];
[UUID.data getBytes:b1];
[UUID.data getBytes:b1 length:16];
return ((b1[0] << 8) | b1[1]);
}

Expand Down