Skip to contentSkip to conversation

don't validate symlink target component length

PATCH In review Christoph Hellwig 2 participants 2 messages Apr 7, 2008 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 don't validate symlink target component length

This validtion is not posix conform and no other Linux filesystem does it.

fs/xfs/xfs_vnodeops.c +0 -25
Index: linux-2.6-xfs/fs/xfs/xfs_vnodeops.c
===================================================================
@@ -3105,31 +3105,6 @@ xfs_symlink(
 	pathlen = strlen(target_path);
 	if (pathlen >= MAXPATHLEN)      /* total string too long */
 		return XFS_ERROR(ENAMETOOLONG);
-	if (pathlen >= MAXNAMELEN) {    /* is any component too long? */
-		int len, total;
-		char *path;
-
-		for (total = 0, path = target_path; total < pathlen;) {
-			/*
-			 * Skip any slashes.
-			 */
-			while(*path == '/') {
-				total++;
-				path++;
-			}
-
-			/*
-			 * Count up to the next slash or end of path.
-			 * Error out if the component is bigger than MAXNAMELEN.
-			 */
-			for(len = 0; *path != '/' && total < pathlen;total++, path++) {
-				if (++len >= MAXNAMELEN) {
-					error = ENAMETOOLONG;
-					return error;
-				}
-			}
-		}
-	}
 
 	if (DM_EVENT_ENABLED(dp, DM_EVENT_SYMLINK)) {
 		error = XFS_SEND_NAMESP(mp, DM_EVENT_SYMLINK, dp,
#1 lore raw
Quoted 2 lines · Christoph Hellwig

This validtion is not posix conform and no other Linux filesystem does it.

Beat me to it, Christoph. ;)

I'll run it through QA.

Cheers,

Dave.

Signature · 3 lines
Dave Chinner
Principal Engineer
SGI Australian Software Group