aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ufs/inode.c
diff options
context:
space:
mode:
authorDuane Griffin <duaneg@dghda.com>2009-01-08 17:43:50 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2009-03-27 14:43:58 -0400
commitb12903f1384cd176a3994a6bf6caf5a482169cc8 (patch)
tree99374b159fe52a6df58b3143ded8b71ac2ee7f91 /fs/ufs/inode.c
parentf33219b7a90c4779a0b59e11fb35ebc4542db328 (diff)
ufs: ensure fast symlinks are NUL-terminated
Ensure fast symlink targets are NUL-terminated, even if corrupted on-disk. Signed-off-by: Duane Griffin <duaneg@dghda.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ufs/inode.c')
-rw-r--r--fs/ufs/inode.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c
index ac8b324415d3..3d2512c21f05 100644
--- a/fs/ufs/inode.c
+++ b/fs/ufs/inode.c
@@ -658,7 +658,8 @@ static int ufs1_read_inode(struct inode *inode, struct ufs_inode *ufs_inode)
658 sizeof(ufs_inode->ui_u2.ui_addr)); 658 sizeof(ufs_inode->ui_u2.ui_addr));
659 } else { 659 } else {
660 memcpy(ufsi->i_u1.i_symlink, ufs_inode->ui_u2.ui_symlink, 660 memcpy(ufsi->i_u1.i_symlink, ufs_inode->ui_u2.ui_symlink,
661 sizeof(ufs_inode->ui_u2.ui_symlink)); 661 sizeof(ufs_inode->ui_u2.ui_symlink) - 1);
662 ufsi->i_u1.i_symlink[sizeof(ufs_inode->ui_u2.ui_symlink) - 1] = 0;
662 } 663 }
663 return 0; 664 return 0;
664} 665}
@@ -706,7 +707,8 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode)
706 sizeof(ufs2_inode->ui_u2.ui_addr)); 707 sizeof(ufs2_inode->ui_u2.ui_addr));
707 } else { 708 } else {
708 memcpy(ufsi->i_u1.i_symlink, ufs2_inode->ui_u2.ui_symlink, 709 memcpy(ufsi->i_u1.i_symlink, ufs2_inode->ui_u2.ui_symlink,
709 sizeof(ufs2_inode->ui_u2.ui_symlink)); 710 sizeof(ufs2_inode->ui_u2.ui_symlink) - 1);
711 ufsi->i_u1.i_symlink[sizeof(ufs2_inode->ui_u2.ui_symlink) - 1] = 0;
710 } 712 }
711 return 0; 713 return 0;
712} 714}