Re: [PATCH 20/25] libsemanage: Fallback_user_level can be NULL if you

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

 



segfault still not exist.

1. Download and extract refpolicy-2.20110726.tar.bz2
2. cd refplicy && edit build.conf
TYPE = standard
...
3. make conf && make policy && make load
...
make: *** [load] Segmentation fault (core dumped)


The attached patch will be OK. :)

- Pascal O.Y.


On 2011年12月20日 05:28, Daniel J Walsh wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


    This patch looks good to me. acked.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7vrJEACgkQrlYvE4MpobP4ewCfUTl1JHSaXTpPtNUn1yJWDo1j
TMgAn0HPi8GRUqi8WdOugTGJReqXBKUV
=MQcr
-----END PGP SIGNATURE-----

>From 64aff2c80f28280724f64628d6bf4c4722b4f75f Mon Sep 17 00:00:00 2001
From: Xin Ouyang <xinpascal@xxxxxxxxx>
Date: Thu, 12 Jan 2012 16:58:34 +0800
Subject: [PATCH] libsemanage: Fix segfault for building standard policies.

If you are building "standard" policies(not MCS/MLS), libsemanage
will crash, which caused by strdup() to "level" NULL pointers.
For example, semodule -s refpolicy -b base.pp -i a.pp
---
 libsemanage/src/genhomedircon.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/libsemanage/src/genhomedircon.c b/libsemanage/src/genhomedircon.c
index d2646ae..262a6cd 100644
--- a/libsemanage/src/genhomedircon.c
+++ b/libsemanage/src/genhomedircon.c
@@ -778,6 +778,8 @@ static int setup_fallback_user(genhomedircon_settings_t * s)
 			{
 				prefix = semanage_user_get_prefix(u);
 				level = semanage_user_get_mlslevel(u);
+				if (level == NULL)
+					level = "";
 			}
 
 			if (set_fallback_user(s, seuname, prefix, level) != 0)
@@ -861,6 +863,8 @@ static genhomedircon_user_entry_t *get_users(genhomedircon_settings_t * s,
 		if (u) {
 			prefix = semanage_user_get_prefix(*u);
 			level = semanage_user_get_mlslevel(*u);
+			if (level == NULL)
+				level = "";
 		} else {
 			prefix = name;
 			level = "s0";
-- 
1.7.7.3


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

  Powered by Linux