diff mbox

[V9fs-developer] Readlink patch

Message ID faaa6f890910111247h5b3faa8bhc54c47df1bd47507@mail.gmail.com (mailing list archive)
State Accepted, archived
Delegated to: Eric Van Hensbergen
Headers show

Commit Message

Martin Stava Oct. 11, 2009, 7:47 p.m. UTC
None
diff mbox

Patch

diff -uprN -X linux-2.6.31.1-vanilla/Documentation/dontdiff
linux-2.6.31.1-vanilla/fs/9p/vfs_inode.c
linux-2.6.31.1/fs/9p/vfs_inode.c
--- linux-2.6.31.1-vanilla/fs/9p/vfs_inode.c	2009-09-24 17:45:25.000000000 +0200
+++ linux-2.6.31.1/fs/9p/vfs_inode.c	2009-10-03 14:04:42.000000000 +0200
@@ -939,7 +939,7 @@  static int v9fs_readlink(struct dentry *
 	P9_DPRINTK(P9_DEBUG_VFS,
 		"%s -> %s (%s)\n", dentry->d_name.name, st->extension, buffer);

-	retval = buflen;
+	retval = min(strlen(st->extension), (size_t)buflen);

 done:
 	kfree(st);
@@ -1007,7 +1007,7 @@  static void *v9fs_vfs_follow_link(struct
 			__putname(link);
 			link = ERR_PTR(len);
		} else
-			link[len] = 0;
+			link[min(len, PATH_MAX-1)] = 0;
 	}
 	nd_set_link(nd, link);