From c4c94ada3fecc28b53b84d51157bc37fb00236da Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy <ab@samba.org> Date: Wed, 16 Feb 2022 14:04:47 +0200 Subject: setcifsacl: fix memory allocation for struct cifs_ace We don't have 'struct cifs_aces' so the correct struct name is 'struct cifs_ace'. The code only worked because 'struct unknown *' is compatible with 'struct cifs_ace *'. Signed-off-by: Alexander Bokovoy <ab@samba.org> --- setcifsacl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'setcifsacl.c') diff --git a/setcifsacl.c b/setcifsacl.c index c0ecd41..7ede417 100644 --- a/setcifsacl.c +++ b/setcifsacl.c @@ -492,11 +492,11 @@ build_reorder_aces(struct cifs_ace **facesptr, int numfaces) int i, numallowedaces, numdeniedaces, numallowedinhaces, numdeniedinhaces, numreorderaces; - allowedacesptr = calloc(numfaces, sizeof(struct cifs_aces *)); - deniedacesptr = calloc(numfaces, sizeof(struct cifs_aces *)); - allowedinhacesptr = calloc(numfaces, sizeof(struct cifs_aces *)); - deniedinhacesptr = calloc(numfaces, sizeof(struct cifs_aces *)); - reorderacesptr = calloc(numfaces, sizeof(struct cifs_aces *)); + allowedacesptr = calloc(numfaces, sizeof(struct cifs_ace *)); + deniedacesptr = calloc(numfaces, sizeof(struct cifs_ace *)); + allowedinhacesptr = calloc(numfaces, sizeof(struct cifs_ace *)); + deniedinhacesptr = calloc(numfaces, sizeof(struct cifs_ace *)); + reorderacesptr = calloc(numfaces, sizeof(struct cifs_ace *)); numallowedaces = 0; numdeniedaces = 0; @@ -631,7 +631,7 @@ ace_add_reorder(struct cifs_ntsd *pntsd, struct cifs_ntsd **npntsd, ssize_t *buf int i, rc, numaces; numaces = numfaces + numcaces; - totalacesptr = calloc(numaces, sizeof(struct cifs_aces *)); + totalacesptr = calloc(numaces, sizeof(struct cifs_ace *)); for (i = 0; i < numfaces; i++) { totalacesptr[i] = facesptr[i]; @@ -780,7 +780,7 @@ build_fetched_aces(char *aclptr, int numfaces) char *acl_base; struct cifs_ace *pace, **facesptr; - facesptr = calloc(numfaces, sizeof(struct cifs_aces *)); + facesptr = calloc(numfaces, sizeof(struct cifs_ace *)); if (!facesptr) { fprintf(stderr, "%s: Error %d allocating ACE array", __func__, errno); @@ -1112,7 +1112,7 @@ build_cmdline_aces(char **arrptr, int numcaces, ace_kinds ace_kind) char *acesid, *acetype, *aceflag, *acemask; struct cifs_ace **cacesptr; - cacesptr = calloc(numcaces, sizeof(struct cifs_aces *)); + cacesptr = calloc(numcaces, sizeof(struct cifs_ace *)); if (!cacesptr) { fprintf(stderr, "%s: Error %d allocating ACE array", __func__, errno); -- cgit v1.2.3