Skip to content

BetrayalPromise/SecureDefence

Repository files navigation

SecureDefense

CI Status Version License Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

/*
入参异常防御
*/

#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wnonnull"

NSArray * array = [NSArray new];
[array safeContainer];
id result = array[1000];
NSLog(@"%@", result);

[self safeKeyValue];
[self setValue:nil forKey:nil];
[self valueForKey:nil];
[self setValue:nil forKey:@"dfadfadfa"];
[self setValue:@"dfadfad" forKey:nil];

[[NSUserDefaults standardUserDefaults] safeUserDefaults];
[[NSUserDefaults standardUserDefaults] objectForKey:nil];

#pragma clang diagnostic pop


#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wundeclared-selector"

/*
转发防御
*/

[NSObject safeGuardUnrecognizedSelector];

[NSObject performSelector:@selector(AAAA)];
[self performSelector:@selector(AAAA)];
[NSObject performSelector:@selector(AAAA)];
[self performSelector:@selector(AAAA)];

#pragma clang diagnostic pop

Requirements

Installation

SecureDefense is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SecureDefense'

Author

BetrayalPromise, [email protected]

License

SecureDefense is available under the MIT license. See the LICENSE file for more info.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published