From b1f9d5201ae7c3174d29fb49ff77f1e9c5bce65e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Pierre=20Andr=C3=A9?= Date: Mon, 19 Apr 2010 11:05:20 +0200 Subject: [PATCH] fixed a bug in ACL inheritance --- libntfs-3g/acls.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libntfs-3g/acls.c b/libntfs-3g/acls.c index ab1a3557..eda7a3ad 100644 --- a/libntfs-3g/acls.c +++ b/libntfs-3g/acls.c @@ -563,7 +563,8 @@ static BOOL valid_acl(const ACL *pacl, unsigned int end) &((const char*)pacl)[offace]; acesz = le16_to_cpu(pace->size); if (((offace + acesz) > end) - || !ntfs_valid_sid(&pace->sid)) + || !ntfs_valid_sid(&pace->sid) + || ((ntfs_sid_size(&pace->sid) + 8) != (int)acesz)) ok = FALSE; offace += acesz; } @@ -707,10 +708,12 @@ int ntfs_inherit_acl(const ACL *oldacl, ACL *newacl, if (ntfs_same_sid(&pnewace->sid, ownersid)) { memcpy(&pnewace->sid, usid, usidsz); acesz = usidsz + 8; + pnewace->size = cpu_to_le16(acesz); } if (ntfs_same_sid(&pnewace->sid, groupsid)) { memcpy(&pnewace->sid, gsid, gsidsz); acesz = gsidsz + 8; + pnewace->size = cpu_to_le16(acesz); } if (pnewace->mask & GENERIC_ALL) { pnewace->mask &= ~GENERIC_ALL;