Skip to content

Commit

Permalink
Convert security patch level NSString to NSInteger and use that to co…
Browse files Browse the repository at this point in the history
…mpare versions.
  • Loading branch information
futureimperfect committed Feb 23, 2018
1 parent 7aa7480 commit a281520
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion EFIgy/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -411,12 +411,14 @@ - (BOOL)checkBuildGreaterThanKnown
NSString *securityPatchLevel = [self.buildNumber substringFromIndex:actualRange.location + 1];
NSString *expectedPatchLevel = [expectedBuild substringWithRange:expectedRange];
NSString *expectedSecurityPatchLevel = [expectedBuild substringFromIndex:actualRange.location + 1];
NSInteger securityPatchLevelInt = [securityPatchLevel integerValue];
NSInteger expectedSecurityPatchLevelInt = [expectedSecurityPatchLevel integerValue];
if (patchLevel && securityPatchLevel && expectedPatchLevel && expectedSecurityPatchLevel) {
if ([patchLevel compare:expectedPatchLevel] == NSOrderedDescending) {
// Current patch level is greater than expected patch level,
// (e.g., D > C).
return YES;
} else if ([patchLevel isEqualToString:expectedPatchLevel] && [securityPatchLevel compare:expectedSecurityPatchLevel] == NSOrderedDescending) {
} else if ([patchLevel isEqualToString:expectedPatchLevel] && securityPatchLevelInt > expectedSecurityPatchLevelInt) {
// Current patch level is equal to expected patch level,
// but security patch level is greater than expected security
// patch level, (e.g., D480 > D47, because D == D && 480 > 47).
Expand Down

0 comments on commit a281520

Please sign in to comment.