[PATCH 38/48] libselinux: Remove assert in

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


   This patch looks good to me. acked.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7dHY0ACgkQrlYvE4MpobP0TQCglLzwZcwDzypvmE3NRiVVFVAc
YN0AnicCgg98vp0lxmGa4G3kv/kFjskq
=yD/F
-----END PGP SIGNATURE-----
>From dc44015c2e805c7b569d0889b1ba6be1b2464910 Mon Sep 17 00:00:00 2001
From: Richard Haines <richard_c_haines@xxxxxxxxxxxxxx>
Date: Sun, 27 Nov 2011 16:11:37 +0000
Subject: [PATCH 38/48] libselinux: Remove assert in
 security_get_boolean_names(3)

Remove assert in security_get_boolean_names(3) if the len invalid and stop seg
fault if names is null. Set EINVAL instead and return error.

Signed-off-by: Richard Haines <richard_c_haines@xxxxxxxxxxxxxx>
Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
---
 libselinux/src/booleans.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/libselinux/src/booleans.c b/libselinux/src/booleans.c
index bbf8324..1510043 100644
--- a/libselinux/src/booleans.c
+++ b/libselinux/src/booleans.c
@@ -8,7 +8,6 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
-#include <assert.h>
 #include <stdlib.h>
 #include <dirent.h>
 #include <string.h>
@@ -41,7 +40,10 @@ int security_get_boolean_names(char ***names, int *len)
 	struct dirent **namelist;
 	char **n;
 
-	assert(len);
+	if (!len || names == NULL) {
+		errno = EINVAL;
+		return -1;
+	}
 	if (!selinux_mnt) {
 		errno = ENOENT;
 		return -1;
-- 
1.7.7.4


[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux