Skip to content

Commit

Permalink
fix: Prevent ObjC object dereferencing if debugging is not enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
ohaiibuzzle authored and IsaacMarovitz committed May 8, 2023
1 parent 10e48d5 commit dd1518f
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions PlayTools/PlayLoader.m
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,10 @@ static OSStatus pt_SecItemCopyMatching(CFDictionaryRef query, CFTypeRef *result)
retval = SecItemCopyMatching(query, result);
}
if (result != NULL) {
[PlayKeychain debugLogger:[NSString stringWithFormat:@"SecItemCopyMatching: %@", query]];
[PlayKeychain debugLogger:[NSString stringWithFormat:@"SecItemCopyMatching result: %@", *result]];
if ([[PlaySettings shared] playChainDebugging]) {
[PlayKeychain debugLogger:[NSString stringWithFormat:@"SecItemCopyMatching: %@", query]];
[PlayKeychain debugLogger:[NSString stringWithFormat:@"SecItemCopyMatching result: %@", *result]];
}
}
return retval;
}
Expand All @@ -118,8 +120,10 @@ static OSStatus pt_SecItemAdd(CFDictionaryRef attributes, CFTypeRef *result) {
retval = SecItemAdd(attributes, result);
}
if (result != NULL) {
[PlayKeychain debugLogger: [NSString stringWithFormat:@"SecItemAdd: %@", attributes]];
[PlayKeychain debugLogger: [NSString stringWithFormat:@"SecItemAdd result: %@", *result]];
if ([[PlaySettings shared] playChainDebugging]) {
[PlayKeychain debugLogger: [NSString stringWithFormat:@"SecItemAdd: %@", attributes]];
[PlayKeychain debugLogger: [NSString stringWithFormat:@"SecItemAdd result: %@", *result]];
}
}
return retval;
}
Expand All @@ -132,8 +136,10 @@ static OSStatus pt_SecItemUpdate(CFDictionaryRef query, CFDictionaryRef attribut
retval = SecItemUpdate(query, attributesToUpdate);
}
if (attributesToUpdate != NULL) {
[PlayKeychain debugLogger: [NSString stringWithFormat:@"SecItemUpdate: %@", query]];
[PlayKeychain debugLogger: [NSString stringWithFormat:@"SecItemUpdate attributesToUpdate: %@", attributesToUpdate]];
if ([[PlaySettings shared] playChainDebugging]) {
[PlayKeychain debugLogger: [NSString stringWithFormat:@"SecItemUpdate: %@", query]];
[PlayKeychain debugLogger: [NSString stringWithFormat:@"SecItemUpdate attributesToUpdate: %@", attributesToUpdate]];
}
}
return retval;

Expand All @@ -146,7 +152,9 @@ static OSStatus pt_SecItemDelete(CFDictionaryRef query) {
} else {
retval = SecItemDelete(query);
}
[PlayKeychain debugLogger: [NSString stringWithFormat:@"SecItemDelete: %@", query]];
if ([[PlaySettings shared] playChainDebugging]) {
[PlayKeychain debugLogger: [NSString stringWithFormat:@"SecItemDelete: %@", query]];
}
return retval;
}

Expand Down

0 comments on commit dd1518f

Please sign in to comment.