Message ID | 20231113232014.48621-1-luhuaxin1@huawei.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Petr Lautrbach |
Headers | show |
Series | libsepol: add check for category value before printing | expand |
diff --git a/libsepol/src/expand.c b/libsepol/src/expand.c index ee5f9185..9ed22bfd 100644 --- a/libsepol/src/expand.c +++ b/libsepol/src/expand.c @@ -945,8 +945,8 @@ int mls_semantic_level_expand(mls_semantic_level_t * sl, mls_level_t * l, for (cat = sl->cat; cat; cat = cat->next) { if (!cat->low || cat->low > cat->high) { ERR(h, "Category range is not valid %s.%s", - p->p_cat_val_to_name[cat->low - 1], - p->p_cat_val_to_name[cat->high - 1]); + cat->low > 0 ? p->p_cat_val_to_name[cat->low - 1] : "n/a", + cat->high > 0 ? p->p_cat_val_to_name[cat->high - 1] : "n/a"); return -1; } for (i = cat->low - 1; i < cat->high; i++) {