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 a null pointer crash in cJSON_ReplaceItemViaPointer #726

Merged

Conversation

hopper-vul
Copy link
Contributor

If the parent passed in cJSON_ReplaceItemViaPointer has not a child, which means parent->child is null, a null pointer dereference crash will be happened inside cJSON_ReplaceItemViaPointer.

This commit adds the NULL check of parent->child beforehand to inform user such incorrect usage.

fixes: #725

Signed-off-by: hopper-vul hopper.vul@gmail.com

If the parent passed in cJSON_ReplaceItemViaPointer has not a child, which means parent->child is null, a null pointer dereference crash will be happened inside cJSON_ReplaceItemViaPointer.

This commit adds the NULL check of `parent->child` beforehand to inform user such incorrect usage.

Signed-off-by: hopper-vul <hopper.vul@gmail.com>
@hopper-vul
Copy link
Contributor Author

@cragwen Hi, would your like to review this pull request #722 which suffer from the similar issue.

@Alanscut Alanscut merged commit 766dd9d into DaveGamble:master Jul 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A null pointer crash in cJSON_ReplaceItemViaPointer
3 participants