Skip to content

Commit

Permalink
Fixed potential crasher in code signing in the case that the host app…
Browse files Browse the repository at this point in the history
…lication is not code signed.
  • Loading branch information
andymatuschak committed Jul 24, 2012
1 parent a59e8ff commit 3d8be2d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions SUCodeSigningVerifier.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ + (BOOL)codeSignatureIsValidAtPath:(NSString *)destinationPath error:(NSError **
// This API didn't exist prior to 10.6.
if (SecCodeCopySelf == NULL) return NO;

SecRequirementRef requirement = NULL;
OSStatus result;

SecRequirementRef requirement = NULL;
SecStaticCodeRef staticCode = NULL;
SecCodeRef hostCode = NULL;

result = SecCodeCopySelf(kSecCSDefaultFlags, &hostCode);
if (result != 0) {
SULog(@"Failed to copy host code %d", result);
Expand All @@ -42,7 +43,6 @@ + (BOOL)codeSignatureIsValidAtPath:(NSString *)destinationPath error:(NSError **
goto finally;
}

SecStaticCodeRef staticCode = NULL;
NSBundle *newBundle = [NSBundle bundleWithPath:destinationPath];
if (!newBundle) {
SULog(@"Failed to load NSBundle for update");
Expand Down

0 comments on commit 3d8be2d

Please sign in to comment.