Skip to content

cJSON_Utils.c variable 'patch' is possible a dereference of null pointer #516

@oshunter

Description

@oshunter

The "cJSON_Utils.c" line 1408 on the function of "static cJSON *generate_merge_patch(cJSON * const from, cJSON * const to, const cJSON_bool case_sensitive)"

from_child = from->child;
to_child = to->child;
patch = cJSON_CreateObject(); // Better to add the NULL result check? 
while (from_child || to_child)

the 'patch' result is possible to NULL and line 1456 "if (patch->child == NULL)" used the pointer to access to field 'child' results in a dereference of a null pointer.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions