]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs: Validate the length of on-disk ACLs
authorAndreas Gruenbacher <agruenba@redhat.com>
Wed, 17 Feb 2016 05:45:50 +0000 (16:45 +1100)
committerDave Chinner <david@fromorbit.com>
Wed, 17 Feb 2016 05:45:50 +0000 (16:45 +1100)
Source kernel commit 86a21c79745ca97676cbd47f8608839382cc0448

In xfs_acl_from_disk, instead of trusting that xfs_acl.acl_cnt is correct,
make sure that the length of the attributes is correct as well.  Also, turn
the aclp parameter into a const pointer.

Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
libxfs/xfs_format.h

index 7eae0a5cf3735dd6a726e9a348531ce523ac4dee..f89b6e0fc67dfa7e46484bdc7a37c15c47d49695 100644 (file)
@@ -1502,9 +1502,13 @@ struct xfs_acl {
                                                sizeof(struct xfs_acl_entry) \
                : 25)
 
-#define XFS_ACL_MAX_SIZE(mp) \
+#define XFS_ACL_SIZE(cnt) \
        (sizeof(struct xfs_acl) + \
-               sizeof(struct xfs_acl_entry) * XFS_ACL_MAX_ENTRIES((mp)))
+               sizeof(struct xfs_acl_entry) * cnt)
+
+#define XFS_ACL_MAX_SIZE(mp) \
+       XFS_ACL_SIZE(XFS_ACL_MAX_ENTRIES((mp)))
+
 
 /* On-disk XFS extended attribute names */
 #define SGI_ACL_FILE           "SGI_ACL_FILE"