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 <richard_c_haines@btinternet.com> Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
parent
83161f73ea
commit
aed37210a3
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue