]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commitdiff
xfs_repair: properly detect reserved attribute names
authorEric Sandeen <sandeen@redhat.com>
Tue, 26 May 2015 22:43:02 +0000 (08:43 +1000)
committerDave Chinner <david@fromorbit.com>
Tue, 26 May 2015 22:43:02 +0000 (08:43 +1000)
This function in xfs_repair tries to make sure that if an attr
name reserved for acls exists in the root namespace, then its
value is a valid acl.

However, because it only compares up to the length of the
reserved name, superstrings may match and cause false positive
xfs_repair errors.

Ensure that both the length and the content match before
flagging it as an error.

Spotted-by: Zach Brown <zab@zabbo.net>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/attr_repair.c

index d60b66478b82d5b8f1340a4a1e02fd31d39d68d1..5ce7bb63f750d67ba8bec5ae65bb72d3a2fa1c7a 100644 (file)
@@ -746,9 +746,10 @@ valuecheck(
        void *valuep;
        int clearit = 0;
 
-       if ((strncmp(namevalue, SGI_ACL_FILE, SGI_ACL_FILE_SIZE) == 0) ||
-                       (strncmp(namevalue, SGI_ACL_DEFAULT,
-                               SGI_ACL_DEFAULT_SIZE) == 0)) {
+       if ((namelen == SGI_ACL_FILE_SIZE &&
+            strncmp(namevalue, SGI_ACL_FILE, SGI_ACL_FILE_SIZE) == 0) ||
+           (namelen == SGI_ACL_DEFAULT_SIZE &&
+            strncmp(namevalue, SGI_ACL_DEFAULT, SGI_ACL_DEFAULT_SIZE) == 0)) {
                if (value == NULL) {
                        valuep = malloc(valuelen);
                        if (!valuep)