Skip to content

Commit

Permalink
libsepol/cil: Check for empty list when marking neverallow attributes
Browse files Browse the repository at this point in the history
When marking a type attribute as used in a neverallow (to help determine
whether or not it should be expanded), check if the attribute's expression
list is empty (no attributes are associated with it) before iterating
over the list.

Signed-off-by: James Carter <jwcart2@gmail.com>
Acked-by: Nicolas Iooss <nicolas.iooss@m4x.org>
  • Loading branch information
jwcart2 committed Jun 24, 2021
1 parent ac8b35d commit f33745a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions libsepol/cil/src/cil_post.c
Expand Up @@ -1494,6 +1494,10 @@ static void __mark_neverallow_attrs(struct cil_list *expr_list)
{
struct cil_list_item *curr;

if (!expr_list) {
return;
}

cil_list_for_each(curr, expr_list) {
if (curr->flavor == CIL_DATUM) {
if (FLAVOR(curr->data) == CIL_TYPEATTRIBUTE) {
Expand Down

0 comments on commit f33745a

Please sign in to comment.