[libselinux/f17] Fix segfault when calling audit2why.init or audit2why.finish() python bindings more then once.

Daniel J Walsh dwalsh at fedoraproject.org
Tue Oct 16 17:15:54 UTC 2012


commit 6b2b011ea6cb019b4e8e6857983a9a27568e1d35
Author: rhatdan <dwalsh at redhat.com>
Date:   Tue Oct 16 13:15:29 2012 -0400

    Fix segfault when calling audit2why.init or audit2why.finish() python bindings more then once.

 libselinux-audit2why.patch |   24 ++++++++++++++++++++++++
 libselinux.spec            |    9 +++++++--
 2 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/libselinux-audit2why.patch b/libselinux-audit2why.patch
new file mode 100644
index 0000000..2f5accb
--- /dev/null
+++ b/libselinux-audit2why.patch
@@ -0,0 +1,24 @@
+diff -up libselinux-2.1.10/src/audit2why.c~ libselinux-2.1.10/src/audit2why.c
+--- libselinux-2.1.10/src/audit2why.c~	2012-10-16 13:10:49.836777130 -0400
++++ libselinux-2.1.10/src/audit2why.c	2012-10-16 13:12:44.211844593 -0400
+@@ -164,6 +164,9 @@ static PyObject *finish(PyObject *self _
+   
+ 	if (PyArg_ParseTuple(args,(char *)":finish")) {
+ 		int i = 0;
++		if (! avc)
++			Py_RETURN_NONE;
++
+ 		for (i = 0; i < boolcnt; i++) {
+ 			free(boollist[i]->name);
+ 			free(boollist[i]);
+@@ -288,6 +291,10 @@ static int __policy_init(const char *ini
+ static PyObject *init(PyObject *self __attribute__((unused)), PyObject *args) {
+   int result;
+   char *init_path=NULL;
++  if (avc) {
++	  PyErr_SetString( PyExc_RuntimeError, "init called multiple times");
++	  return NULL;
++  }
+   if (!PyArg_ParseTuple(args,(char *)"|s:policy_init",&init_path))
+     return NULL;
+   result = __policy_init(init_path);
diff --git a/libselinux.spec b/libselinux.spec
index f96e4d6..1ca2dd9 100644
--- a/libselinux.spec
+++ b/libselinux.spec
@@ -8,12 +8,13 @@
 Summary: SELinux library and simple utilities
 Name: libselinux
 Version: 2.1.10
-Release: 4%{?dist}
+Release: 5%{?dist}
 License: Public Domain
 Group: System Environment/Libraries
 Source: %{name}-%{version}.tgz
 Url: http://oss.tresys.com/git/selinux.git
 Patch1: libselinux-rhat.patch
+Patch2: libselinux-audit2why.patch
 BuildRequires: pkgconfig python-devel ruby-devel ruby libsepol-static >= %{libsepolver} swig
 %if 0%{?with_python3}
 BuildRequires: python3-devel
@@ -97,6 +98,7 @@ needed for developing SELinux applications.
 %prep
 %setup -q
 %patch1 -p2 -b .rhat
+%patch2 -p2 -b .audit2why
 
 %build
 # To support building the Python wrapper against multiple Python runtimes
@@ -233,6 +235,9 @@ rm -rf %{buildroot}
 %{ruby_sitearch}/selinux.so
 
 %changelog
+* Tue Oct 16 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.10-5
+- Fix segfault when calling audit2why.init or audit2why.finish() python bindings more then once.
+
 * Mon Apr 23 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.10-4
 - Rebuild to get latest libsepol which fixes the file_name transition problems
 
@@ -240,7 +245,7 @@ rm -rf %{buildroot}
 - Add support for lxc contexts file
 
 * Fri Mar 30 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.10-2
-- Add support fot boolean subs file
+- Add support for boolean subs file
 
 * Thu Mar 29 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.10-1
 - Update to upstream 


More information about the scm-commits mailing list