Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the crash of -[NSNull _fastCStringContents:] #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions AltSign/Model/Apple API/ALTCertificate.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ NS_ASSUME_NONNULL_BEGIN
@property (nonatomic, copy) NSString *serialNumber;

@property (nonatomic, copy, nullable) NSString *identifier;
@property (nonatomic, copy, nullable) NSString *machineName;
@property (nonatomic, copy, nullable) NSString *machineIdentifier;
@property (nonatomic, copy, nullable) id machineName;
@property (nonatomic, copy, nullable) id machineIdentifier;
Comment on lines +19 to +20
Copy link
Owner

@rileytestut rileytestut Aug 31, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing these property types from NSString (which it should be) to id doesn't really seem to address the underlying issue, which is that when parsing certificates the machineName and machineIdentifier keys might be "null" (from what I understand). Plus, this makes working with this library from Swift much more frustrating due to type erasure.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This API is from Apple, they use NSNull. You have to do compatible hack...
If I'm the author of Apple's Private Framework, I will not use suck a hack logic (return NSNull instead of nil)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand, but it'd be better to update -[ALTCertificate initWithResponseDictionary:] to explicitly check for NULL values and assign nil instead to those properties, rather than assign the NSNull object directly and change the public API.


@property (nonatomic, copy, nullable) NSData *data;
@property (nonatomic, copy, nullable) NSData *privateKey;
Expand Down