libsepol: Turn assert into error in type_set_expand()
PATCH v2 1/1 libsepol: Turn assert into error in type_set_expand()
The assertion in function type_set_expand() can only be violated by a malformed policy. Since it is called before the policy has been validated just return an error.
Signed-off-by James Carter <[email protected]>
---
v2: Do not delete the continue
libsepol/src/expand.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
libsepol/src/expand.c +2 -1
@@ -2827,7 +2827,8 @@ int type_set_expand(type_set_t *set, ebitmap_t *t, policydb_t *p,for (i =0 ; i < p->p_types.nprim; i++) {if (p->type_val_to_struct[i] && p->type_val_to_struct[i]->flavor ==TYPE_ATTRIB ) { -assert (!ebitmap_get_bit (t, i)); +if (ebitmap_get_bit (t, i)) + goto err_neg;continue ; }if (ebitmap_get_bit (t, i)) {
Signature · 1 line
2.55.0
Quoted 6 lines · James Carter
The assertion in function
type_set_expand()can only be violated by a malformed policy. Since it is called before the policy has been validated just return an error.Signed-off-by James Carter <[email protected]>
Acked-by Stephen Smalley <[email protected]>
Stephen Smalley
maintainerQuoted 10 lines · Stephen Smalley
Quoted 6 lines · James Carter
The assertion in function
type_set_expand()can only be violated by a malformed policy. Since it is called before the policy has been validated just return an error.Signed-off-by James Carter <[email protected]>Acked-by Stephen Smalley <[email protected]>
Merged.