- cil: Check that sym_index is within bounds (RHEL-34823) - cil: Initialize avtab_datum on declaration (RHEL-34810) - mls: Do not destroy context on memory error (RHEL-34810) - cil/cil_post: Initialize tmp on declaration (RHEL-34810) - Initialize "strs" on declaration (RHEL-34810) Resolves: RHEL-34823, RHEL-34810
41 lines
1.3 KiB
Diff
41 lines
1.3 KiB
Diff
From 77e225361129f02d379e930859406a61420836d7 Mon Sep 17 00:00:00 2001
|
|
From: Vit Mojzis <vmojzis@redhat.com>
|
|
Date: Wed, 23 Oct 2024 15:43:17 +0200
|
|
Subject: [PATCH] libsepol/cil/cil_post: Initialize tmp on declaration
|
|
|
|
tmp.node was not always initialized before being used by
|
|
ebitmap_destroy.
|
|
|
|
Fixes:
|
|
Error: UNINIT (CWE-457):
|
|
libsepol-3.7/cil/src/cil_post.c:1309:2: var_decl: Declaring variable "tmp" without initializer.
|
|
libsepol-3.7/cil/src/cil_post.c:1382:6: uninit_use_in_call: Using uninitialized value "tmp.node" when calling "ebitmap_destroy".
|
|
\# 1380| if (rc != SEPOL_OK) {
|
|
\# 1381| cil_log(CIL_INFO, "Failed to apply operator to bitmaps\n");
|
|
\# 1382|-> ebitmap_destroy(&tmp);
|
|
\# 1383| goto exit;
|
|
\# 1384| }
|
|
|
|
Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
|
|
Acked-by: James Carter <jwcart2@gmail.com>
|
|
---
|
|
libsepol/cil/src/cil_post.c | 2 ++
|
|
1 file changed, 2 insertions(+)
|
|
|
|
diff --git a/libsepol/cil/src/cil_post.c b/libsepol/cil/src/cil_post.c
|
|
index ac99997f..d63a5496 100644
|
|
--- a/libsepol/cil/src/cil_post.c
|
|
+++ b/libsepol/cil/src/cil_post.c
|
|
@@ -1315,6 +1315,8 @@ static int __cil_expr_to_bitmap(struct cil_list *expr, ebitmap_t *out, int max,
|
|
curr = expr->head;
|
|
flavor = expr->flavor;
|
|
|
|
+ ebitmap_init(&tmp);
|
|
+
|
|
if (curr->flavor == CIL_OP) {
|
|
enum cil_flavor op = (enum cil_flavor)(uintptr_t)curr->data;
|
|
|
|
--
|
|
2.47.0
|
|
|