libsepol: initialize s in constraint_expr_eval_reason

clang's static analyzer reports that s[0] can be uninitialized when used
in:

    sprintf(tmp_buf, "%s %s\n",
                    xcontext ? "Validatetrans" : "Constraint",
                    s[0] ? "GRANTED" : "DENIED");

Silence this false-positive issue by making s always initialized.

Signed-off-by: Nicolas Iooss <nicolas.iooss@m4x.org>
Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
Nicolas Iooss 2022-06-29 09:20:55 +02:00 committed by James Carter
parent f505a73b06
commit d2fecbb97b
1 changed files with 1 additions and 1 deletions

View File

@ -394,7 +394,7 @@ static int constraint_expr_eval_reason(context_struct_t *scontext,
role_datum_t *r1, *r2;
mls_level_t *l1, *l2;
constraint_expr_t *e;
int s[CEXPR_MAXDEPTH];
int s[CEXPR_MAXDEPTH] = {};
int sp = -1;
char tmp_buf[128];