Fixed the maximum size of an ACL

Define the maximum size of an ACL as results from the maximum number of
sub-authorities defined in layout.h
This commit is contained in:
Jean-Pierre André 2016-04-06 10:02:23 +02:00
parent 6c768f215d
commit e8170f588f
2 changed files with 5 additions and 4 deletions

View File

@ -102,10 +102,11 @@
#define ROOT_GROUP_UNMARK FILE_READ_EA /* ACL granted to root as group */
/*
* A type large enough to hold any SID
* Maximum SID size and a type large enough to hold it
*/
typedef char BIGSID[40];
#define MAX_SID_SIZE (8 + SID_MAX_SUB_AUTHORITIES*4)
typedef char BIGSID[MAX_SID_SIZE];
/*
* Struct to hold the input mapping file

View File

@ -2790,10 +2790,10 @@ char *ntfs_build_descr_posix(struct MAPPING* const mapping[],
for (k=0; k<pxdesc->acccnt; k++) {
if ((pxdesc->acl.ace[k].tag == POSIX_ACL_USER)
|| (pxdesc->acl.ace[k].tag == POSIX_ACL_GROUP))
newattrsz += 3*40; /* fixme : maximum size */
newattrsz += 3*MAX_SID_SIZE;
}
/* account for default ACE's */
newattrsz += 2*40*pxdesc->defcnt; /* fixme : maximum size */
newattrsz += 2*MAX_SID_SIZE*pxdesc->defcnt;
newattr = (char*)ntfs_malloc(newattrsz);
if (newattr) {
/* build the main header part */