Fix asprintf within an asprintf call
This commit is contained in:
		
							parent
							
								
									114463ed84
								
							
						
					
					
						commit
						f21a19ce73
					
				| @ -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; | ||||
|  | ||||
| @ -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@redhat.com> - 2.1.8-2 | ||||
| - Fix asprintf within an asprintf call | ||||
| 
 | ||||
| * Wed Jul 4 2012 Dan Walsh <dwalsh@redhat.com> - 2.1.8-1 | ||||
| - Update to upstream  | ||||
| 	* remove build warning when build swig c files | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user