Skip to content

Commit 3ebc542

Browse files
committed
index 0 beyond bounds for empty NSArray fix
1 parent abec116 commit 3ebc542

File tree

4 files changed

+54
-6
lines changed

4 files changed

+54
-6
lines changed

Hackintool.xcodeproj/project.pbxproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -715,7 +715,7 @@
715715
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
716716
CODE_SIGN_STYLE = Automatic;
717717
COMBINE_HIDPI_IMAGES = YES;
718-
CURRENT_PROJECT_VERSION = 0374;
718+
CURRENT_PROJECT_VERSION = 0375;
719719
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
720720
ENABLE_HARDENED_RUNTIME = YES;
721721
ENABLE_STRICT_OBJC_MSGSEND = NO;
@@ -730,7 +730,7 @@
730730
INFOPLIST_FILE = "Hackintool/Hackintool-Info.plist";
731731
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks";
732732
MACOSX_DEPLOYMENT_TARGET = 10.9;
733-
MARKETING_VERSION = 3.7.4;
733+
MARKETING_VERSION = 3.7.5;
734734
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.Hackintool;
735735
PRODUCT_NAME = "$(TARGET_NAME)";
736736
PROVISIONING_PROFILE_SPECIFIER = "";
@@ -751,7 +751,7 @@
751751
CODE_SIGN_INJECT_BASE_ENTITLEMENTS = NO;
752752
CODE_SIGN_STYLE = Automatic;
753753
COMBINE_HIDPI_IMAGES = YES;
754-
CURRENT_PROJECT_VERSION = 0374;
754+
CURRENT_PROJECT_VERSION = 0375;
755755
DEVELOPMENT_TEAM = 5LGHPJM9ZR;
756756
ENABLE_HARDENED_RUNTIME = YES;
757757
ENABLE_STRICT_OBJC_MSGSEND = NO;
@@ -766,7 +766,7 @@
766766
INFOPLIST_FILE = "Hackintool/Hackintool-Info.plist";
767767
LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @executable_path/../Frameworks";
768768
MACOSX_DEPLOYMENT_TARGET = 10.9;
769-
MARKETING_VERSION = 3.7.4;
769+
MARKETING_VERSION = 3.7.5;
770770
PRODUCT_BUNDLE_IDENTIFIER = com.Headsoft.Hackintool;
771771
PRODUCT_NAME = "$(TARGET_NAME)";
772772
PROVISIONING_PROFILE_SPECIFIER = "";

Hackintool/AppDelegate.m

+38-2
Original file line numberDiff line numberDiff line change
@@ -2058,7 +2058,25 @@ - (BOOL)getNativeBluetoothDeviceInfo:(NSMutableDictionary *)bluetoothDeviceDicti
20582058
return NO;
20592059
}
20602060

2061-
NSDictionary *controllerDictionary = [[[[bluetoothArray objectAtIndex:0] objectForKey:@"_items"] objectAtIndex:0] objectForKey:@"controller_properties"];
2061+
if ([bluetoothArray count] == 0)
2062+
return NO;
2063+
2064+
NSDictionary *controllerDictionary = [bluetoothArray objectAtIndex:0];
2065+
2066+
if (controllerDictionary == nil)
2067+
return NO;
2068+
2069+
NSArray *controllerArray = [controllerDictionary objectForKey:@"_items"];
2070+
2071+
if (controllerArray == nil || [controllerArray count] == 0)
2072+
return NO;
2073+
2074+
controllerDictionary = [controllerArray objectAtIndex:0];
2075+
2076+
if (controllerDictionary == nil)
2077+
return NO;
2078+
2079+
controllerDictionary = [controllerDictionary objectForKey:@"controller_properties"];
20622080

20632081
if (controllerDictionary == nil)
20642082
return NO;
@@ -10718,7 +10736,25 @@ - (BOOL)createWindowsBluetoothRegistryFile
1071810736
return NO;
1071910737
}
1072010738

10721-
bluetoothArray = [[[[bluetoothArray objectAtIndex:0] objectForKey:@"_items"] objectAtIndex:0] objectForKey:@"devices_list"];
10739+
if ([bluetoothArray count] == 0)
10740+
return NO;
10741+
10742+
NSDictionary *controllerDictionary = [bluetoothArray objectAtIndex:0];
10743+
10744+
if (controllerDictionary == nil)
10745+
return NO;
10746+
10747+
NSArray *controllerArray = [controllerDictionary objectForKey:@"_items"];
10748+
10749+
if (controllerArray == nil || [controllerArray count] == 0)
10750+
return NO;
10751+
10752+
controllerDictionary = [controllerArray objectAtIndex:0];
10753+
10754+
if (controllerDictionary == nil)
10755+
return NO;
10756+
10757+
bluetoothArray = [controllerDictionary objectForKey:@"devices_list"];
1072210758

1072310759
if (bluetoothArray == nil)
1072410760
return NO;

Hackintool/IORegTools.m

+12
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,18 @@ bool getIORegBluetoothArray(NSMutableArray **propertyArray)
12391239
CFRelease(usbProductString);
12401240
}
12411241

1242+
CFNumberRef builtIn = nil;
1243+
1244+
if (CFDictionaryGetValueIfPresent(parentProperties, CFSTR("Built-in"), (const void **)&builtIn))
1245+
{
1246+
if ([(__bridge NSNumber *)builtIn boolValue])
1247+
{
1248+
// Built-in
1249+
}
1250+
1251+
CFRelease(builtIn);
1252+
}
1253+
12421254
if (skipDevice)
12431255
continue;
12441256

0 commit comments

Comments
 (0)