libsepol: validate empty common classes in scope indices

Validate no common classes inside scope indices are defined.

Reported-by: oss-fuzz (issue 64849)
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
Christian Göttsche 2023-12-11 15:55:40 +01:00 committed by James Carter
parent d0b1400afb
commit e54bedce80
1 changed files with 2 additions and 0 deletions

View File

@ -1344,6 +1344,8 @@ bad:
static int validate_scope_index(sepol_handle_t *handle, const scope_index_t *scope_index, validate_t flavors[])
{
if (!ebitmap_is_empty(&scope_index->scope[SYM_COMMONS]))
goto bad;
if (validate_ebitmap(&scope_index->p_classes_scope, &flavors[SYM_CLASSES]))
goto bad;
if (validate_ebitmap(&scope_index->p_roles_scope, &flavors[SYM_ROLES]))