Skip to content

Check for a parent without children in cJSON_DetachItemViaPointer - #1087

Open
prownd wants to merge 1 commit into
DaveGamble:masterfrom
prownd:check-for-a-parent-without-children-in-cJSON_DetachItemViaPointer-s01
Open

prownd wants to merge 1 commit into
DaveGamble:masterfrom
prownd:check-for-a-parent-without-children-in-cJSON_DetachItemViaPointer-s01

Conversation

@prownd

@prownd prownd commented Sep 20, 2026

Copy link
Copy Markdown

fixes #743

When the item is not the parent's first child but the parent has no children at all, cJSON_DetachItemViaPointer() unlinked the item from its neighbours and then dereferenced parent->child (NULL) to update the pointer to the last element, crashing. An item can't be detached from a parent without children, return NULL instead.

 DaveGamble#743

When the item is not the parent's first child but the parent has no
children at all, cJSON_DetachItemViaPointer() unlinked the item from its
neighbours and then dereferenced parent->child (NULL) to update the
pointer to the last element, crashing. An item can't be detached from a
parent without children, return NULL instead.
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.

bug for cJSON_DetachItemViaPointer function

1 participant