[libsemanage] Fix asprintf within an asprintf call
Daniel J Walsh
dwalsh at fedoraproject.org
Thu Jul 12 21:47:22 UTC 2012
commit f21a19ce7365554fea0b55c25d4cdaf20739254f
Author: Dan Walsh <dwalsh at redhat.com>
Date: Thu Jul 12 17:47:17 2012 -0400
Fix asprintf within an asprintf call
libsemanage-rhat.patch | 31 +++++++++++++++++++++++++++++--
libsemanage.spec | 5 ++++-
2 files changed, 33 insertions(+), 3 deletions(-)
---
diff --git a/libsemanage-rhat.patch b/libsemanage-rhat.patch
index 6c5a31e..76e1480 100644
--- a/libsemanage-rhat.patch
+++ b/libsemanage-rhat.patch
@@ -29,10 +29,37 @@ index fc64919..c63bb22 100644
$(LIBA): $(OBJS)
$(AR) rcs $@ $^
diff --git a/libsemanage/src/handle.c b/libsemanage/src/handle.c
-index 7fcd2b4..f5cd4d0 100644
+index 7fcd2b4..976e3ff 100644
--- a/libsemanage/src/handle.c
+++ b/libsemanage/src/handle.c
-@@ -147,7 +147,8 @@ const char *semanage_binary_policy_path() {
+@@ -66,6 +66,8 @@ void semanage_free_root() {
+ }
+
+ int semanage_set_root(const char *path) {
++ char *binary_policy_path;
++
+ semanage_free_root();
+ if ( asprintf(&private_selinux_path, "%s/%s", path, selinux_path()) < 0 ) {
+ goto error;
+@@ -91,9 +93,16 @@ int semanage_set_root(const char *path) {
+ goto error;
+ }
+
+- if ( asprintf(&private_binary_policy_path, "%s/%s", path, selinux_binary_policy_path()) < 0 ) {
++ binary_policy_path = selinux_binary_policy_path();
++ if (!binary_policy_path) {
++ goto error;
++ }
++
++ if ( asprintf(&private_binary_policy_path, "%s/%s", path, binary_policy_path) < 0 ) {
++ free(binary_policy_path);
+ goto error;
+ }
++ free(binary_policy_path);
+
+ if ( asprintf(&private_usersconf_path, "%s/%s", path, selinux_usersconf_path()) < 0 ) {
+ goto error;
+@@ -147,7 +156,8 @@ const char *semanage_binary_policy_path() {
// printf("private_binary_policy_path %s\n", private_binary_policy_path);
if (private_binary_policy_path)
return private_binary_policy_path;
diff --git a/libsemanage.spec b/libsemanage.spec
index 650e488..b25185f 100644
--- a/libsemanage.spec
+++ b/libsemanage.spec
@@ -10,7 +10,7 @@
Summary: SELinux binary policy manipulation library
Name: libsemanage
Version: 2.1.8
-Release: 1%{?dist}
+Release: 2%{?dist}
License: LGPLv2+
Group: System Environment/Libraries
Source: libsemanage-%{version}.tgz
@@ -180,6 +180,9 @@ rm -rf ${RPM_BUILD_ROOT}
%endif # if with_python3
%changelog
+* Thu Jul 12 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.8-2
+- Fix asprintf within an asprintf call
+
* Wed Jul 4 2012 Dan Walsh <dwalsh at redhat.com> - 2.1.8-1
- Update to upstream
* remove build warning when build swig c files
More information about the scm-commits
mailing list