fs: ext4: fix symlink read function
PATCH 1/1 fs: ext4: fix symlink read function
From: Ronald Zachariah <[email protected]>
The function ext4fs_read_symlink was unable to handle a symlink which had target name of exactly 60 characters.
Signed-off-by Ronald Zachariah <[email protected]>
Signed-off-by Stefan Roese <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Tom Rini <[email protected]>
--- fs/ext4/ext4_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/ext4_common.c +1 -1
@@ -2040,7 +2040,7 @@ static char *ext4fs_read_symlink(struct ext2fs_node *node)if (!symlink)return 0 ; -if (__le32_to_cpu (diro->inode.size) <=60 ) { +if (__le32_to_cpu (diro->inode.size) <60 ) {strncpy (symlink, diro->inode.b.symlink,__le32_to_cpu (diro->inode.size)); }else {
Signature · 1 line
2.8.1
PATCH 1/1 fs: ext4: fix symlink read function
Quoted 4 lines · Stefan Roese
From: Ronald Zachariah <[email protected]>
The function
ext4fs_read_symlinkwas unable to handle a symlink which had target name of exactly 60 characters.
Reviewed-by Stephen Warren <[email protected]>
This seems to match how the Linux kernel encodes symlinks.
fs/ext4/ext4_common.c static char *ext4fs_read_symlink(struct ext2fs_node *node) · line 2043
Quoted 2 lines
fs/ext4/ext4_common.c +1
-1-if (__le32_to_cpu (diro->inode.size) <=60 ) { +if (__le32_to_cpu (diro->inode.size) <60 ) {
It'd be nice if "60" was replaced with sizeof(diro->inode.b.symlink), but that's probably a topic for a different patch.