From 190aab31464252838b93065a3dc2e058e0d00200 Mon Sep 17 00:00:00 2001 From: Xin Ouyang Date: Thu, 16 Feb 2012 15:17:58 +0800 Subject: libsemanage: Add a patch to fix a segfault bug. --- .../Fix-segfault-for-standard-policy.patch | 37 ++++++++++++++++++++++ recipes-security/selinux/libsemanage_2.1.6.bb | 2 ++ 2 files changed, 39 insertions(+) create mode 100644 recipes-security/selinux/libsemanage-2.1.6/Fix-segfault-for-standard-policy.patch 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 @@ +From 64aff2c80f28280724f64628d6bf4c4722b4f75f Mon Sep 17 00:00:00 2001 +From: Xin Ouyang +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 +--- + src/genhomedircon.c | 4 ++++ + 1 files changed, 4 insertions(+), 0 deletions(-) + +diff --git a/src/genhomedircon.c b/src/genhomedircon.c +index d2646ae..262a6cd 100644 +--- a/src/genhomedircon.c ++++ b/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 + 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" S = "${WORKDIR}/git/libsemanage" DEPENDS += "libsepol libselinux ustr bzip2 python" +SRC_URI += "file://Fix-segfault-for-standard-policy.patch" + PACKAGES += "${PN}-python" FILES_${PN}-python = "${libdir}/python${PYTHON_BASEVERSION}/site-packages/*" FILES_${PN}-dbg += "${libdir}/python${PYTHON_BASEVERSION}/site-packages/.debug/*" -- cgit v1.2.3-54-g00ecf