1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00

Ensure we always have a valid pointer on unmarshalling an SD with zero

ace entries.
Jeremy.
(This used to be commit 274c0f5028)
This commit is contained in:
Jeremy Allison 2001-06-26 06:31:55 +00:00
parent 0c563186fb
commit 96ff4b8ee2

View File

@ -211,9 +211,13 @@ BOOL sec_io_acl(char *desc, SEC_ACL **ppsa, prs_struct *ps, int depth)
if(!prs_uint32("num_aces ", ps, depth, &psa->num_aces))
return False;
if (UNMARSHALLING(ps) && psa->num_aces != 0) {
/* reading */
if((psa->ace = (SEC_ACE *)prs_alloc_mem(ps,sizeof(psa->ace[0]) * psa->num_aces)) == NULL)
if (UNMARSHALLING(ps)) {
/*
* Even if the num_aces is zero, allocate memory as there's a difference
* between a non-present DACL (allow all access) and a DACL with no ACE's
* (allow no access).
*/
if((psa->ace = (SEC_ACE *)prs_alloc_mem(ps,sizeof(psa->ace[0]) * (psa->num_aces+1))) == NULL)
return False;
}