libsepol: use correct size for initial string list

Use the number of categories not levels, which might be zero, for the
string list initial size of categories.

Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
This commit is contained in:
Christian Göttsche 2021-12-09 17:49:12 +01:00 committed by James Carter
parent 731540202a
commit 35ef9b95e7

View File

@ -918,7 +918,7 @@ static int write_category_rules_to_conf(FILE *out, struct policydb *pdb)
unsigned i, j, num;
int rc = 0;
rc = strs_init(&strs, pdb->p_levels.nprim);
rc = strs_init(&strs, pdb->p_cats.nprim);
if (rc != 0) {
goto exit;
}