summaryrefslogtreecommitdiffstats
path: root/source3/modules/nfs4_acls.c
diff options
context:
space:
mode:
authorAlexander Werth <alexander.werth@de.ibm.com>2013-10-29 16:20:04 +0100
committerDavid Disseldorp <ddiss@samba.org>2013-10-30 18:44:40 +0100
commita6bc2fd0d1df3746d7ae3d987765b346feee2bd8 (patch)
tree3eaa4a1934edc48935a8302183bac88ded4926ae /source3/modules/nfs4_acls.c
parentd35ce088fe28745e81d2d3efee94f9d04242d2c2 (diff)
downloadsamba-a6bc2fd0d1df3746d7ae3d987765b346feee2bd8.tar.gz
samba-a6bc2fd0d1df3746d7ae3d987765b346feee2bd8.tar.xz
samba-a6bc2fd0d1df3746d7ae3d987765b346feee2bd8.zip
s3:modules: Fix realloc with zero sized ACLs
A realloc with size zero is similar to a free. Since we return the number of acls that's not an error. Signed-off-by: Alexander Werth <alexander.werth@de.ibm.com> Reviewed-by: David Disseldorp <ddiss@samba.org>
Diffstat (limited to 'source3/modules/nfs4_acls.c')
-rw-r--r--source3/modules/nfs4_acls.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/source3/modules/nfs4_acls.c b/source3/modules/nfs4_acls.c
index 500cb4772a3..1366ba15c33 100644
--- a/source3/modules/nfs4_acls.c
+++ b/source3/modules/nfs4_acls.c
@@ -336,7 +336,7 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx,
mem_ctx, 2 * aclint->naces * sizeof(struct security_ace));
if (nt_ace_list==NULL)
{
- DEBUG(10, ("talloc error"));
+ DEBUG(10, ("talloc error with %d aces", aclint->naces));
errno = ENOMEM;
return false;
}
@@ -473,10 +473,12 @@ static bool smbacl4_nfs42win(TALLOC_CTX *mem_ctx,
}
}
- nt_ace_list = (struct security_ace *)TALLOC_REALLOC(mem_ctx,
- nt_ace_list,
- good_aces * sizeof(struct security_ace));
- if (nt_ace_list == NULL) {
+ nt_ace_list = (struct security_ace *)
+ TALLOC_REALLOC(mem_ctx, nt_ace_list,
+ good_aces * sizeof(struct security_ace));
+ /* returns a NULL ace list when good_aces is zero. */
+ if (good_aces && nt_ace_list == NULL) {
+ DEBUG(10, ("realloc error with %d aces", good_aces));
errno = ENOMEM;
return false;
}