libsepol: do not modify p->p_roles.nprim in role_set_expand

There is no reason to modify the number of roles defined in a policy
when no role is being inserted.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
This commit is contained in:
Nicolas Iooss 2016-11-23 23:06:42 +01:00 committed by Stephen Smalley
parent 2907caa33c
commit 86bad3dbf9

View file

@ -2424,7 +2424,7 @@ int role_set_expand(role_set_t * x, ebitmap_t * r, policydb_t * out, policydb_t
ebitmap_init(r);
if (x->flags & ROLE_STAR) {
for (i = 0; i < p->p_roles.nprim++; i++)
for (i = 0; i < p->p_roles.nprim; i++)
if (ebitmap_set_bit(r, i, 1))
return -1;
return 0;