libsysdecode: report invalid cap_rights_t
Previously we'd have an assertion failure in cap_rights_is_set if sysdecode_cap_rights is called with an invalid cap_rights_t, so test for validity first. PR: 222258 Reviewed by: cem MFC after: 1 month Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D12391
This commit is contained in:
parent
def11ea1c5
commit
007c856ab0
@ -1028,8 +1028,15 @@ void
|
|||||||
sysdecode_cap_rights(FILE *fp, cap_rights_t *rightsp)
|
sysdecode_cap_rights(FILE *fp, cap_rights_t *rightsp)
|
||||||
{
|
{
|
||||||
struct name_table *t;
|
struct name_table *t;
|
||||||
|
int i;
|
||||||
bool comma;
|
bool comma;
|
||||||
|
|
||||||
|
for (i = 0; i < CAPARSIZE(rightsp); i++) {
|
||||||
|
if (CAPIDXBIT(rightsp->cr_rights[i]) != 1 << i) {
|
||||||
|
fprintf(fp, "invalid cap_rights_t");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
comma = false;
|
comma = false;
|
||||||
for (t = caprights; t->str != NULL; t++) {
|
for (t = caprights; t->str != NULL; t++) {
|
||||||
if (cap_rights_is_set(rightsp, t->val)) {
|
if (cap_rights_is_set(rightsp, t->val)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user