From: Wayne Davison Date: Tue, 22 Jul 2008 15:31:17 +0000 (-0700) Subject: Fixed a potential alignment issue in the IRIX ACL code when allocating X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/aacd188034703acc9d4ab43704d627f5d48a7eb8 Fixed a potential alignment issue in the IRIX ACL code when allocating the initial struct acl object. Also, cast mallocs to avoid warnings. --- diff --git a/lib/sysacls.c b/lib/sysacls.c index 071b06f8..7334fd40 100644 --- a/lib/sysacls.c +++ b/lib/sysacls.c @@ -551,7 +551,7 @@ SMB_ACL_T sys_acl_init(int count) * acl[] array, this actually allocates an ACL with room * for (count+1) entries */ - if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof(struct SMB_ACL_T) + count * sizeof(struct acl))) == NULL) { + if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof a[0] + count * sizeof (struct acl))) == NULL) { errno = ENOMEM; return NULL; } @@ -1007,7 +1007,7 @@ SMB_ACL_T sys_acl_init(int count) * acl[] array, this actually allocates an ACL with room * for (count+1) entries */ - if ((a = SMB_MALLOC(sizeof(struct SMB_ACL_T) + count * sizeof(struct acl))) == NULL) { + if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof a[0] + count * sizeof(struct acl))) == NULL) { errno = ENOMEM; return NULL; } @@ -1638,14 +1638,14 @@ SMB_ACL_T sys_acl_init(int count) return NULL; } - if ((a = SMB_MALLOC(sizeof(struct SMB_ACL_T) + sizeof(struct acl))) == NULL) { + if ((a = (SMB_ACL_T)SMB_MALLOC(sizeof a[0] + sizeof (struct acl))) == NULL) { errno = ENOMEM; return NULL; } a->next = -1; a->freeaclp = False; - a->aclp = (struct acl *)(&a->aclp + sizeof(struct acl *)); + a->aclp = (struct acl *)((char *)a + sizeof a[0]); a->aclp->acl_cnt = 0; return a;