diff --git a/include/ntfs-3g/acls.h b/include/ntfs-3g/acls.h index a91eda7c..6506f78e 100644 --- a/include/ntfs-3g/acls.h +++ b/include/ntfs-3g/acls.h @@ -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 diff --git a/libntfs-3g/acls.c b/libntfs-3g/acls.c index 1df88aa6..524cc83c 100644 --- a/libntfs-3g/acls.c +++ b/libntfs-3g/acls.c @@ -2790,10 +2790,10 @@ char *ntfs_build_descr_posix(struct MAPPING* const mapping[], for (k=0; kacccnt; 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 */