From: Eric Sandeen Date: Tue, 26 May 2015 22:43:02 +0000 (+1000) Subject: xfs_repair: properly detect reserved attribute names X-Git-Tag: v3.2.3-rc2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d6cfd5aee844e7e11f4e313da370bbc4a4cec450;p=thirdparty%2Fxfsprogs-dev.git 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 --- 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)