-
Notifications
You must be signed in to change notification settings - Fork 34
Validate if memory was successfully allocated before continuing. #1111
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
Conversation
| [mutData appendBytes:&size length:sizeof(size)]; | ||
|
|
||
| uint8_t *pbDerivedKey = [self kdfCounterMode:(uint8_t*)_symmetricKey.bytes | ||
| keyDerivationKeyLength:_symmetricKey.length |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request does not update changelog.txt.
Please consider if this change would be noticeable to a partner or user and either update changelog.txt or resolve this conversation.
oldalton
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a question about NULL vs nil
| fixedInput:(uint8_t*)mutData.bytes | ||
| fixedInputLength:mutData.length]; | ||
|
|
||
| if (pbDerivedKey == nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should this be NULL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right, updated.
| ctr = 1; | ||
| keyDerivated = (uint8_t *)malloc(outputSizeBit / 8); //output is 32 bytes | ||
|
|
||
| if (keyDerivated == nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, should we use NULL?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
| fixedInput:fixedInput | ||
| fixedInput_length:fixedInputLength]; | ||
|
|
||
| if (dataInput == nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same question here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
| { | ||
| uint8_t *tmpFixedInput = (uint8_t *)malloc(fixedInput_length + 4); //+4 is caused from the ct | ||
|
|
||
| if (tmpFixedInput == nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated
Proposed changes
Add checks to make sure memory allocation is successful before continuing the process.
Suggested in AzureAD/microsoft-authentication-library-for-objc#1497
Type of change
Risk
Additional information