From cede7f80260a25ca42aed422c6b5189b675e834b Mon Sep 17 00:00:00 2001 From: Zorg Date: Sun, 30 Jun 2024 06:49:13 -0700 Subject: [PATCH] Check codeInfoFlags != nil --- Bit Slicer/ZGDocumentWindowController.m | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Bit Slicer/ZGDocumentWindowController.m b/Bit Slicer/ZGDocumentWindowController.m index a62d693f..cb1e9fda 100644 --- a/Bit Slicer/ZGDocumentWindowController.m +++ b/Bit Slicer/ZGDocumentWindowController.m @@ -1743,13 +1743,16 @@ - (BOOL)isCurrentProcessProtectedByEntitlement if (copySigningInfoCode == noErr) { NSNumber *codeInfoFlags = signingInformation[(NSString *)kSecCodeInfoFlags]; - SecCodeSignatureFlags codeSignatureFlags = codeInfoFlags.unsignedIntValue; - - // I don't think kSecCodeSignatureRuntime is really correct (apps can opt into hardened runtime - // and still be debugged), but it's probably a good enough heuristic - if ((codeSignatureFlags & kSecCodeSignatureRestrict) != 0 || (codeSignatureFlags & kSecCodeSignatureRuntime) != 0) + if (codeInfoFlags != nil) { - return YES; + SecCodeSignatureFlags codeSignatureFlags = codeInfoFlags.unsignedIntValue; + + // I don't think kSecCodeSignatureRuntime is really correct (apps can opt into hardened runtime + // and still be debugged), but it's probably a good enough heuristic + if ((codeSignatureFlags & kSecCodeSignatureRestrict) != 0 || (codeSignatureFlags & kSecCodeSignatureRuntime) != 0) + { + return YES; + } } } }