40 lines
1.4 KiB
Diff
40 lines
1.4 KiB
Diff
|
From 29d6a3ee4a958607fdf7c01a78b6d389ba6e8612 Mon Sep 17 00:00:00 2001
|
||
|
From: James Carter <jwcart2@gmail.com>
|
||
|
Date: Thu, 13 May 2021 12:36:44 -0400
|
||
|
Subject: [PATCH] libsepol/cil: Destroy the permission nodes when exiting with
|
||
|
an error
|
||
|
|
||
|
When exiting with an error because a class or common has too many
|
||
|
permissions, destroy the permission nodes.
|
||
|
|
||
|
This bug was found by the secilc-fuzzer.
|
||
|
|
||
|
Signed-off-by: James Carter <jwcart2@gmail.com>
|
||
|
---
|
||
|
libsepol/cil/src/cil_build_ast.c | 2 ++
|
||
|
1 file changed, 2 insertions(+)
|
||
|
|
||
|
diff --git a/libsepol/cil/src/cil_build_ast.c b/libsepol/cil/src/cil_build_ast.c
|
||
|
index 87043a8fa183..71f14e20e25e 100644
|
||
|
--- a/libsepol/cil/src/cil_build_ast.c
|
||
|
+++ b/libsepol/cil/src/cil_build_ast.c
|
||
|
@@ -444,6 +444,7 @@ int cil_gen_class(struct cil_db *db, struct cil_tree_node *parse_current, struct
|
||
|
}
|
||
|
if (class->num_perms > CIL_PERMS_PER_CLASS) {
|
||
|
cil_tree_log(parse_current, CIL_ERR, "Too many permissions in class '%s'", class->datum.name);
|
||
|
+ cil_tree_children_destroy(ast_node);
|
||
|
rc = SEPOL_ERR;
|
||
|
goto exit;
|
||
|
}
|
||
|
@@ -1019,6 +1020,7 @@ int cil_gen_common(struct cil_db *db, struct cil_tree_node *parse_current, struc
|
||
|
}
|
||
|
if (common->num_perms > CIL_PERMS_PER_CLASS) {
|
||
|
cil_tree_log(parse_current, CIL_ERR, "Too many permissions in common '%s'", common->datum.name);
|
||
|
+ cil_tree_children_destroy(ast_node);
|
||
|
rc = SEPOL_ERR;
|
||
|
goto exit;
|
||
|
}
|
||
|
--
|
||
|
2.32.0
|
||
|
|