[PATCH 11/47] libsemanage: check memory allocations

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>

Signed-off-by: Christian Göttsche <cgzones@xxxxxxxxxxxxxx>
---
 libsemanage/src/conf-parse.y | 6 ++++++
 libsemanage/src/handle.c     | 2 ++
 2 files changed, 8 insertions(+)

diff --git a/libsemanage/src/conf-parse.y b/libsemanage/src/conf-parse.y
index 9e58345a..9c806fdd 100644
--- a/libsemanage/src/conf-parse.y
+++ b/libsemanage/src/conf-parse.y
@@ -369,6 +369,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/libsemanage/src/handle.c b/libsemanage/src/handle.c
index d5baa614..f048f6d7 100644
--- a/libsemanage/src/handle.c
+++ b/libsemanage/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.45.2





[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux