diff options
author | Duane Griffin <duaneg@dghda.com> | 2009-01-08 22:43:50 +0000 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2009-03-27 14:43:58 -0400 |
commit | b12903f1384cd176a3994a6bf6caf5a482169cc8 (patch) | |
tree | 99374b159fe52a6df58b3143ded8b71ac2ee7f91 /fs/ufs | |
parent | f33219b7a90c4779a0b59e11fb35ebc4542db328 (diff) | |
download | kernel_samsung_smdk4412-b12903f1384cd176a3994a6bf6caf5a482169cc8.zip kernel_samsung_smdk4412-b12903f1384cd176a3994a6bf6caf5a482169cc8.tar.gz kernel_samsung_smdk4412-b12903f1384cd176a3994a6bf6caf5a482169cc8.tar.bz2 |
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')
-rw-r--r-- | fs/ufs/inode.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/ufs/inode.c b/fs/ufs/inode.c index ac8b324..3d2512c 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) sizeof(ufs_inode->ui_u2.ui_addr)); } else { memcpy(ufsi->i_u1.i_symlink, ufs_inode->ui_u2.ui_symlink, - sizeof(ufs_inode->ui_u2.ui_symlink)); + sizeof(ufs_inode->ui_u2.ui_symlink) - 1); + ufsi->i_u1.i_symlink[sizeof(ufs_inode->ui_u2.ui_symlink) - 1] = 0; } return 0; } @@ -706,7 +707,8 @@ static int ufs2_read_inode(struct inode *inode, struct ufs2_inode *ufs2_inode) sizeof(ufs2_inode->ui_u2.ui_addr)); } else { memcpy(ufsi->i_u1.i_symlink, ufs2_inode->ui_u2.ui_symlink, - sizeof(ufs2_inode->ui_u2.ui_symlink)); + sizeof(ufs2_inode->ui_u2.ui_symlink) - 1); + ufsi->i_u1.i_symlink[sizeof(ufs2_inode->ui_u2.ui_symlink) - 1] = 0; } return 0; } |