Skip to content

Commit

Permalink
sch_apply_conditions: check data pointer before use
Browse files Browse the repository at this point in the history
A crash when a data pointer was dereferenced when it was NULL,
is mitigated by checking it first.
  • Loading branch information
tony-vanderpeet authored and carlgsmith committed Nov 3, 2024
1 parent a828e02 commit 721635f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -4180,7 +4180,7 @@ _sch_apply_conditions (sch_instance * instance, sch_node * schema, GNode * root,
}

/* Check the YANG condition if we have a node with a child with data */
if (child && child->children && ((char *) child->children->data)[0] != '\0')
if (child && child->children && child->children->data && ((char *) child->children->data)[0] != '\0')
{
sch_check_condition (schema, child, flags, &path, &condition);
if (condition)
Expand Down

0 comments on commit 721635f

Please sign in to comment.