acl_equiv_mode_np: zero mode on just inited ACL
You can't return 0 and not write the mode if mode_p is non-NULL. That violates the API contract and in common usage leaves stack trash in *mode_p. The acl_equiv_mode_test test passed by accident. Reviewed by: kevans, markj Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D43278
This commit is contained in:
parent
8b144c015c
commit
85c9d36497
|
@ -49,7 +49,7 @@ acl_equiv_mode_np(acl_t acl, mode_t *mode_p)
|
|||
|
||||
/* Linux returns 0 for ACL returned by acl_init() */
|
||||
if (_acl_brand(acl) == ACL_BRAND_UNKNOWN && acl->ats_acl.acl_cnt == 0)
|
||||
return (0);
|
||||
goto done;
|
||||
|
||||
// TODO: Do we want to handle ACL_BRAND_NFS4 in this function? */
|
||||
if (_acl_brand(acl) != ACL_BRAND_POSIX)
|
||||
|
@ -91,6 +91,7 @@ acl_equiv_mode_np(acl_t acl, mode_t *mode_p)
|
|||
}
|
||||
}
|
||||
|
||||
done:
|
||||
if (mode_p != NULL)
|
||||
*mode_p = ret_mode;
|
||||
|
||||
|
|
Loading…
Reference in New Issue