From aed37210a31f3bbfe40926065c83b0b82b0ecafc Mon Sep 17 00:00:00 2001 From: Richard Haines Date: Sun, 27 Nov 2011 16:08:10 +0000 Subject: [PATCH] libselinux: return EINVAL if invalid role selected 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 Signed-off-by: Eric Paris Acked-by: Dan Walsh --- libselinux/src/get_context_list.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libselinux/src/get_context_list.c b/libselinux/src/get_context_list.c index 37d80f28..e02157ce 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;