]> git.feebdaed.xyz Git - 0xmirror/cJSON.git/commit
Fix a null pointer crash in cJSON_ReplaceItemViaPointer (#726)
authorhopper-vul <118949689+hopper-vul@users.noreply.github.com>
Sat, 1 Jul 2023 08:18:32 +0000 (16:18 +0800)
committerGitHub <noreply@github.com>
Sat, 1 Jul 2023 08:18:32 +0000 (16:18 +0800)
commit766dd9d590bfbda32e6f77bff096c15eebffa3f0
tree27b7bc3c30ab64920564a2847b929cd996b66060
parentb45f48e600671feade0b6bd65d1c69de7899f2be
Fix a null pointer crash in cJSON_ReplaceItemViaPointer (#726)

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>
cJSON.c