[prev in list] [next in list] [prev in thread] [next in thread] 

List:       selinux
Subject:    [PATCH 1/1] libselinux - Remove assert in security_get_boolean_names(3)
From:       Richard Haines <richard_c_haines () btinternet ! com>
Date:       2011-11-27 16:11:37
Message-ID: 1322410297.52977.YahooMailClassic () web87014 ! mail ! ird ! yahoo ! com
[Download RAW message or body]

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@btinternet.com>
---
 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.1





--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic