Skip to content

Fix a null pointer crash in cJSON_ReplaceItemViaPointer#726

Merged
Alanscut merged 1 commit into
DaveGamble:masterfrom
hopper-vul:fix-crash-in-ReplaceItemViaPointer
Jul 1, 2023
Merged

Fix a null pointer crash in cJSON_ReplaceItemViaPointer#726
Alanscut merged 1 commit into
DaveGamble:masterfrom
hopper-vul:fix-crash-in-ReplaceItemViaPointer

Conversation

@hopper-vul

Copy link
Copy Markdown
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 [email protected]

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 <[email protected]>
@hopper-vul hopper-vul requested a review from cragwen December 21, 2022 02:42
@hopper-vul

Copy link
Copy Markdown
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