From 205dbb8ad55dfdd98e3839e056a0ff74a933f10d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Tue, 1 Oct 2024 17:22:22 +0200 Subject: [PATCH] Support gaps in type array MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Support gaps in the type array which are supported by libsepol. Encountered while experimenting on a policy optimization step that removes unused type-attributes. Signed-off-by: Christian Göttsche --- setools/policyrep/selinuxpolicy.pxi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/setools/policyrep/selinuxpolicy.pxi b/setools/policyrep/selinuxpolicy.pxi index d7b59fdf..d7178a1b 100644 --- a/setools/policyrep/selinuxpolicy.pxi +++ b/setools/policyrep/selinuxpolicy.pxi @@ -934,6 +934,10 @@ cdef class SELinuxPolicy: for i in range(self.handle.p.symtab[sepol.SYM_TYPES].nprim): tmp_type = self.handle.p.type_val_to_struct[i] + # skip gaps + if tmp_type == NULL: + continue + # skip types if tmp_type.flavor != sepol.TYPE_ATTRIB: continue