patch-2.1.23 linux/fs/ext2/symlink.c

Next file: linux/fs/fat/dir.c
Previous file: linux/fs/ext2/file.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.22/linux/fs/ext2/symlink.c linux/fs/ext2/symlink.c
@@ -122,12 +122,11 @@
 	}
 	else
 		link = (char *) inode->u.ext2_i.i_data;
-	
-	/* XXX I hope link is always '\0'-terminated. */ 	
-	i = strlen(link);
-	if (i >= buflen)
-		i = buflen-1;
-	if (copy_to_user(buffer, link, i+1))
+
+	i = 0;
+	while (i < buflen && link[i])
+		i++;
+	if (copy_to_user(buffer, link, i))
 		i = -EFAULT;
  	if (DO_UPDATE_ATIME(inode)) {
 		inode->i_atime = CURRENT_TIME;

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov