diff options
author | trasz <trasz@FreeBSD.org> | 2009-09-01 18:30:17 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2009-09-01 18:30:17 +0000 |
commit | 008ef8cd3b3a70e55ea6d9679a97a2b162f99ab2 (patch) | |
tree | 7cb6012d0428fe7628ae161aae33175207a7610d /lib/libc/posix1e/acl_calc_mask.c | |
parent | 3c15abf75cb0075339a5b06b9638953cd2ec5db1 (diff) | |
download | FreeBSD-src-008ef8cd3b3a70e55ea6d9679a97a2b162f99ab2.zip FreeBSD-src-008ef8cd3b3a70e55ea6d9679a97a2b162f99ab2.tar.gz |
Fix regression introduced with NFSv4 ACL support - make acl_to_text(3)
and acl_calc_mask(3) return error instead of crashing when acl passed
to them is NULL.
Submitted by: markus
Reviewed by: rwatson
MFC after: 3 days
Diffstat (limited to 'lib/libc/posix1e/acl_calc_mask.c')
-rw-r--r-- | lib/libc/posix1e/acl_calc_mask.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/libc/posix1e/acl_calc_mask.c b/lib/libc/posix1e/acl_calc_mask.c index 95fd260..a2d1527 100644 --- a/lib/libc/posix1e/acl_calc_mask.c +++ b/lib/libc/posix1e/acl_calc_mask.c @@ -50,12 +50,6 @@ acl_calc_mask(acl_t *acl_p) acl_t acl_new; int i, mask_mode, mask_num; - if (!_acl_brand_may_be(*acl_p, ACL_BRAND_POSIX)) { - errno = EINVAL; - return (-1); - } - _acl_brand_as(*acl_p, ACL_BRAND_POSIX); - /* * (23.4.2.4) requires acl_p to point to a pointer to a valid ACL. * Since one of the primary reasons to use this function would be @@ -67,6 +61,13 @@ acl_calc_mask(acl_t *acl_p) errno = EINVAL; return (-1); } + + if (!_acl_brand_may_be(*acl_p, ACL_BRAND_POSIX)) { + errno = EINVAL; + return (-1); + } + _acl_brand_as(*acl_p, ACL_BRAND_POSIX); + acl_int = &(*acl_p)->ats_acl; if ((acl_int->acl_cnt < 3) || (acl_int->acl_cnt > ACL_MAX_ENTRIES)) { errno = EINVAL; |