summaryrefslogtreecommitdiff
path: root/libacl/acl_get_perm.c
diff options
context:
space:
mode:
authorCorinna Vinschen <vinschen@redhat.com>2015-12-26 14:30:49 +0100
committerAndreas Gruenbacher <agruenba@redhat.com>2015-12-26 15:43:01 +0100
commit454e4195a61b4012c6c24e43fff4d21dc1621c4e (patch)
tree9e699bf9881ba839c44f3804c0cca2788a2401d3 /libacl/acl_get_perm.c
parent0b8d28449925711e69d228c24f327c5bf0c2b627 (diff)
downloadacl-454e4195a61b4012c6c24e43fff4d21dc1621c4e.tar.gz
Fix checks for valid permissions in input
The acl_add_perm, acl_delete_perm and acl_get_perm functions accidentally check the input permission bits using a wrong negation operator, ! instead of ~. As a result, the test is always false and thus no invalid permission bits are refused. This patches fixes it. Signed-off-by: Corinna Vinschen <vinschen@redhat.com>
Diffstat (limited to 'libacl/acl_get_perm.c')
-rw-r--r--libacl/acl_get_perm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libacl/acl_get_perm.c b/libacl/acl_get_perm.c
index be492b6..31357b2 100644
--- a/libacl/acl_get_perm.c
+++ b/libacl/acl_get_perm.c
@@ -26,7 +26,7 @@ int
acl_get_perm(acl_permset_t permset_d, acl_perm_t perm)
{
acl_permset_obj *acl_permset_obj_p = ext2int(acl_permset, permset_d);
- if (!acl_permset_obj_p || (perm & !(ACL_READ|ACL_WRITE|ACL_EXECUTE)))
+ if (!acl_permset_obj_p || (perm & ~(ACL_READ|ACL_WRITE|ACL_EXECUTE)))
return -1;
return (acl_permset_obj_p->sperm & perm) != 0;
}