From d6cfd5aee844e7e11f4e313da370bbc4a4cec450 Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Wed, 27 May 2015 08:43:02 +1000 Subject: [PATCH] xfs_repair: properly detect reserved attribute names 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 Signed-off-by: Eric Sandeen Reviewed-by: Brian Foster Signed-off-by: Dave Chinner --- repair/attr_repair.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/repair/attr_repair.c b/repair/attr_repair.c index d60b66478..5ce7bb63f 100644 --- a/repair/attr_repair.c +++ b/repair/attr_repair.c @@ -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) -- 2.50.1