Details
-
Bug
-
Resolution: Fixed
-
Minor
-
None
-
None
-
Ubuntu 15.04
-
3
-
9223372036854775807
Description
Static analysis picked up a potential issue in cYAML_build_error() in lnet/utils/cyaml/cyaml.c :
/* look for the command */
cmd_obj = cYAML_get_object_item(r, (const char *)cmd);
if (cmd_obj != NULL && cmd_obj->cy_type == CYAML_TYPE_ARRAY)
itm = cYAML_create_seq_item(cmd_obj);
else if (cmd_obj == NULL)
else if (cmd_obj != NULL && cmd_obj->cy_type != CYAML_TYPE_ARRAY)
goto failed;
err = cYAML_create_object(itm, entity);
if (err == NULL)
goto failed;
From what I can see, cYAML_create_seq_item() has the potential of returning NULL on the tm = cYAML_create_seq_item(cmd_obj) assignments. Later, the err = cYAML_create_object(itm, entity) statement could pass a NULL itm and this calls insert_item() and then cYAML_insert_child() with a NULL parent which silently ignores the NULL parent insert and the original caller gets to cYAML_create_object() has no error return informing it that the insert failed to be actioned. I think some kind of error handling on itm being NULL should be performed rather than silently ignore it.