From 0c39342d5349fd012e2a8c09c17685d4cbeb2e0a Mon Sep 17 00:00:00 2001 From: Tom Burgin Date: Fri, 6 Oct 2017 13:07:48 -0400 Subject: [PATCH] santad: SNTPolicyProcessor fix nil scope check (#208) Fixes `santactl rule --check` returning `Whitelisted (Scope)` incorrectly --- Source/santad/SNTPolicyProcessor.m | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/santad/SNTPolicyProcessor.m b/Source/santad/SNTPolicyProcessor.m index 7117436eb..1171a9035 100644 --- a/Source/santad/SNTPolicyProcessor.m +++ b/Source/santad/SNTPolicyProcessor.m @@ -132,6 +132,8 @@ - (SNTCachedDecision *)decisionForFilePath:(NSString *)filePath /// @return @c YES if file is in scope, @c NO otherwise. /// - (NSString *)fileIsScopeWhitelisted:(SNTFileInfo *)fi { + if (!fi) return nil; + // Determine if file is within a whitelisted path NSRegularExpression *re = [[SNTConfigurator configurator] whitelistPathRegex]; if ([re numberOfMatchesInString:fi.path options:0 range:NSMakeRange(0, fi.path.length)]) { @@ -147,6 +149,8 @@ - (NSString *)fileIsScopeWhitelisted:(SNTFileInfo *)fi { } - (NSString *)fileIsScopeBlacklisted:(SNTFileInfo *)fi { + if (!fi) return nil; + NSRegularExpression *re = [[SNTConfigurator configurator] blacklistPathRegex]; if ([re numberOfMatchesInString:fi.path options:0 range:NSMakeRange(0, fi.path.length)]) { return @"Blacklist Regex";