From: Nadezhda Ivanova Date: Fri, 25 Sep 2009 01:29:57 +0000 (-0700) Subject: Fixed a dereferenced null pointer. X-Git-Tag: talloc-2.0.1~380 X-Git-Url: http://git.samba.org/samba.git/?p=sfrench%2Fsamba-autobuild%2F.git;a=commitdiff_plain;h=df0d629f3726daf71beaa5ec07b284b865adc000 Fixed a dereferenced null pointer. --- diff --git a/source4/libcli/security/create_descriptor.c b/source4/libcli/security/create_descriptor.c index 1054479f288..ebf07ac0fd4 100644 --- a/source4/libcli/security/create_descriptor.c +++ b/source4/libcli/security/create_descriptor.c @@ -102,9 +102,13 @@ static bool contains_inheritable_aces(struct security_acl *acl) static struct security_acl *preprocess_creator_acl(TALLOC_CTX *mem, struct security_acl *acl) { int i; - struct security_acl *new_acl = talloc_zero(mem, struct security_acl); + struct security_acl *new_acl; + if (!acl) { + return NULL; + } + + new_acl = talloc_zero(mem, struct security_acl); - new_acl->revision = acl->revision; for (i=0; i < acl->num_aces; i++) { struct security_ace *ace = &acl->aces[i]; if (!(ace->flags & SEC_ACE_FLAG_INHERITED_ACE)){ @@ -369,20 +373,14 @@ static bool compute_acl(int acl_type, goto final; } else{ - if (!c_acl){ - if (acl_type == SEC_DESC_DACL_PRESENT && token->default_dacl) - *new_acl = security_acl_dup(new_sd, token->default_dacl); - } - else{ - *new_acl = preprocess_creator_acl(new_sd,c_acl); - if (*new_acl == NULL) - goto final; - if (!postprocess_acl(*new_acl, new_sd->owner_sid, - new_sd->group_sid,generic_map)) - return false; - else - goto final; - } + *new_acl = preprocess_creator_acl(new_sd,c_acl); + if (*new_acl == NULL) + goto final; + if (!postprocess_acl(*new_acl, new_sd->owner_sid, + new_sd->group_sid,generic_map)) + return false; + else + goto final; } final: if (acl_type == SEC_DESC_DACL_PRESENT && new_sd->dacl)