summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin Ouyang <Xin.Ouyang@windriver.com>2012-02-16 15:17:58 +0800
committerXin Ouyang <Xin.Ouyang@windriver.com>2012-02-16 15:17:58 +0800
commit190aab31464252838b93065a3dc2e058e0d00200 (patch)
tree100905396e63d9bd469c35f5e9dc1c31c6becd3e
parentfb56a7119e24596f1cad6c7694c5d9b3f6dfb679 (diff)
downloadmeta-selinux-190aab31464252838b93065a3dc2e058e0d00200.tar.gz
libsemanage: Add a patch to fix a segfault bug.
-rw-r--r--recipes-security/selinux/libsemanage-2.1.6/Fix-segfault-for-standard-policy.patch37
-rw-r--r--recipes-security/selinux/libsemanage_2.1.6.bb2
2 files changed, 39 insertions, 0 deletions
diff --git a/recipes-security/selinux/libsemanage-2.1.6/Fix-segfault-for-standard-policy.patch b/recipes-security/selinux/libsemanage-2.1.6/Fix-segfault-for-standard-policy.patch
new file mode 100644
index 0000000..8672b63
--- /dev/null
+++ b/recipes-security/selinux/libsemanage-2.1.6/Fix-segfault-for-standard-policy.patch
@@ -0,0 +1,37 @@
1From 64aff2c80f28280724f64628d6bf4c4722b4f75f Mon Sep 17 00:00:00 2001
2From: Xin Ouyang <xinpascal@gmail.com>
3Date: Thu, 12 Jan 2012 16:58:34 +0800
4Subject: [PATCH] libsemanage: Fix segfault for building standard policies.
5
6If you are building "standard" policies(not MCS/MLS), libsemanage
7will crash, which caused by strdup() to "level" NULL pointers.
8For example, semodule -s refpolicy -b base.pp -i a.pp
9---
10 src/genhomedircon.c | 4 ++++
11 1 files changed, 4 insertions(+), 0 deletions(-)
12
13diff --git a/src/genhomedircon.c b/src/genhomedircon.c
14index d2646ae..262a6cd 100644
15--- a/src/genhomedircon.c
16+++ b/src/genhomedircon.c
17@@ -778,6 +778,8 @@ static int setup_fallback_user(genhomedircon_settings_t * s)
18 {
19 prefix = semanage_user_get_prefix(u);
20 level = semanage_user_get_mlslevel(u);
21+ if (level == NULL)
22+ level = "";
23 }
24
25 if (set_fallback_user(s, seuname, prefix, level) != 0)
26@@ -861,6 +863,8 @@ static genhomedircon_user_entry_t *get_users(genhomedircon_settings_t * s,
27 if (u) {
28 prefix = semanage_user_get_prefix(*u);
29 level = semanage_user_get_mlslevel(*u);
30+ if (level == NULL)
31+ level = "";
32 } else {
33 prefix = name;
34 level = "s0";
35--
361.7.7.3
37
diff --git a/recipes-security/selinux/libsemanage_2.1.6.bb b/recipes-security/selinux/libsemanage_2.1.6.bb
index 28165f4..aabb472 100644
--- a/recipes-security/selinux/libsemanage_2.1.6.bb
+++ b/recipes-security/selinux/libsemanage_2.1.6.bb
@@ -15,6 +15,8 @@ SRCREV = "339f8079d7b9dd1e0b0138e2d096dc7c60b2092e"
15S = "${WORKDIR}/git/libsemanage" 15S = "${WORKDIR}/git/libsemanage"
16DEPENDS += "libsepol libselinux ustr bzip2 python" 16DEPENDS += "libsepol libselinux ustr bzip2 python"
17 17
18SRC_URI += "file://Fix-segfault-for-standard-policy.patch"
19
18PACKAGES += "${PN}-python" 20PACKAGES += "${PN}-python"
19FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*" 21FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*"
20FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/site-packages/.debug/*" 22FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/site-packages/.debug/*"