Skip to contentSkip to conversation

fs: ext4: fix symlink read function

PATCH Superseded Stefan Roese 2 participants 2 messages Apr 27, 2016 ext4 file system

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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.

---
 fs/ext4/ext4_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/ext4_common.c +1 -1
index 84fba76..868c281 100644
@@ -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
#1 lore raw

PATCH 1/1 fs: ext4: fix symlink read function

Quoted 4 lines · Stefan Roese

From: Ronald Zachariah <[email protected]>

The function ext4fs_read_symlink was unable to handle a symlink which had target name of exactly 60 characters.

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.