[PATCH 1/1] libselinux - return EINVAL if invalid role selected

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

 



For get_default_context_with_role(3) and get_default_context_with_rolelevel(3), return errno = EINVAL if invalid role.

Signed-off-by: Richard Haines <richard_c_haines@xxxxxxxxxxxxxx>
---
 libselinux/src/get_context_list.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/libselinux/src/get_context_list.c b/libselinux/src/get_context_list.c
index 37d80f2..e02157c 100644
--- a/libselinux/src/get_context_list.c
+++ b/libselinux/src/get_context_list.c
@@ -38,8 +38,10 @@ int get_default_context_with_role(const char *user,
 	}
 
 	rc = -1;
-	if (!(*ptr))
+	if (!(*ptr)) {
+		errno = EINVAL;
 		goto out;
+	}
 	*newcon = strdup(*ptr);
 	if (!(*newcon))
 		goto out;
-- 
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@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.


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

  Powered by Linux