mirror of
https://github.com/SELinuxProject/selinux
synced 2025-03-05 01:37:33 +00:00
libsepol/cil: Reset expandtypeattribute rules when resetting AST
A list is created to store type attribute datums when resolving an expandtypeattribute rule and that list needs to be destroyed if the AST is reset or a memory leak will occur. Destroy the list storing type attributes datums when resetting expandtypeattribute rules. This bug was found by the secilc-fuzzer. Signed-off-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
parent
4469c9796e
commit
b57535318a
@ -208,6 +208,11 @@ static void cil_reset_typeattributeset(struct cil_typeattributeset *tas)
|
||||
cil_list_destroy(&tas->datum_expr, CIL_FALSE);
|
||||
}
|
||||
|
||||
static void cil_reset_expandtypeattribute(struct cil_expandtypeattribute *expandattr)
|
||||
{
|
||||
cil_list_destroy(&expandattr->attr_datums, CIL_FALSE);
|
||||
}
|
||||
|
||||
static void cil_reset_avrule(struct cil_avrule *rule)
|
||||
{
|
||||
cil_reset_classperms_list(rule->perms.classperms);
|
||||
@ -531,6 +536,9 @@ int __cil_reset_node(struct cil_tree_node *node, __attribute__((unused)) uint32
|
||||
case CIL_TYPEATTRIBUTESET:
|
||||
cil_reset_typeattributeset(node->data);
|
||||
break;
|
||||
case CIL_EXPANDTYPEATTRIBUTE:
|
||||
cil_reset_expandtypeattribute(node->data);
|
||||
break;
|
||||
case CIL_RANGETRANSITION:
|
||||
cil_reset_rangetransition(node->data);
|
||||
break;
|
||||
@ -630,7 +638,6 @@ int __cil_reset_node(struct cil_tree_node *node, __attribute__((unused)) uint32
|
||||
case CIL_CLASSORDER:
|
||||
case CIL_CATORDER:
|
||||
case CIL_SENSITIVITYORDER:
|
||||
case CIL_EXPANDTYPEATTRIBUTE:
|
||||
break; /* Nothing to reset */
|
||||
default:
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user