53 lines
1.4 KiB
Diff
53 lines
1.4 KiB
Diff
From 7a35e57c64faedbb11a880652604b36dd35afad1 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= <cgzones@googlemail.com>
|
|
Date: Mon, 11 Nov 2024 15:16:30 +0100
|
|
Subject: [PATCH] libsemanage: check memory allocations
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
|
|
Acked-by: James Carter <jwcart2@gmail.com>
|
|
|
|
Conflict:NA
|
|
Reference:https://github.com/SELinuxProject/selinux/commit/7a35e57c64faedbb11a880652604b36dd35afad1
|
|
|
|
---
|
|
src/conf-parse.y | 6 ++++++
|
|
src/handle.c | 2 ++
|
|
2 files changed, 8 insertions(+)
|
|
|
|
diff --git a/src/conf-parse.y b/src/conf-parse.y
|
|
index 2b131eeb..b93080cd 100644
|
|
--- a/src/conf-parse.y
|
|
+++ b/src/conf-parse.y
|
|
@@ -382,6 +382,12 @@ static int semanage_conf_init(semanage_conf_t * conf)
|
|
conf->save_previous = 0;
|
|
conf->save_linked = 0;
|
|
|
|
+ if (!conf->store_path ||
|
|
+ !conf->store_root_path ||
|
|
+ !conf->compiler_directory_path) {
|
|
+ return -1;
|
|
+ }
|
|
+
|
|
if ((conf->load_policy =
|
|
calloc(1, sizeof(*(current_conf->load_policy)))) == NULL) {
|
|
return -1;
|
|
diff --git a/src/handle.c b/src/handle.c
|
|
index d5baa614..f048f6d7 100644
|
|
--- a/src/handle.c
|
|
+++ b/src/handle.c
|
|
@@ -45,6 +45,8 @@ int semanage_set_root(const char *root)
|
|
{
|
|
free(private_semanage_root);
|
|
private_semanage_root = strdup(root);
|
|
+ if (!private_semanage_root)
|
|
+ return -1;
|
|
return 0;
|
|
}
|
|
|
|
--
|
|
2.33.0
|
|
|