libsepol/0004-libsepol-initialize-s-in-constraint_expr_eval_reason.patch
Petr Lautrbach 1b0d1244a7 libsepol-3.4-4
Rebase on upstream f56a72ac9e86
2022-11-21 11:26:09 +01:00

38 lines
1.1 KiB
Diff

From d2fecbb97b79875fe4b135a45206413a77469a27 Mon Sep 17 00:00:00 2001
From: Nicolas Iooss <nicolas.iooss@m4x.org>
Date: Wed, 29 Jun 2022 09:20:55 +0200
Subject: [PATCH] libsepol: initialize s in constraint_expr_eval_reason
Content-type: text/plain
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>
---
libsepol/src/services.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libsepol/src/services.c b/libsepol/src/services.c
index 24412d8372d8..062510ab0ea1 100644
--- a/libsepol/src/services.c
+++ b/libsepol/src/services.c
@@ -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];
--
2.38.1