[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1229022995-9898-5-git-send-email-duaneg@dghda.com>
Date: Thu, 11 Dec 2008 19:16:28 +0000
From: "Duane Griffin" <duaneg@...da.com>
To: linux-kernel@...r.kernel.org
Cc: linux-fsdevel@...r.kernel.org, Boaz Harrosh <bharrosh@...asas.com>,
Duane Griffin <duaneg@...da.com>, linux-ext4@...r.kernel.org
Subject: [PATCH] ext2: ensure link targets are NULL-terminated
Ensure link targets are NULL-terminated, even if corrupted on-disk.
Signed-off-by: Duane Griffin <duaneg@...da.com>
---
fs/ext2/symlink.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/fs/ext2/symlink.c b/fs/ext2/symlink.c
index 4e2426e..9b164ba 100644
--- a/fs/ext2/symlink.c
+++ b/fs/ext2/symlink.c
@@ -24,7 +24,9 @@
static void *ext2_follow_link(struct dentry *dentry, struct nameidata *nd)
{
struct ext2_inode_info *ei = EXT2_I(dentry->d_inode);
- nd_set_link(nd, (char *)ei->i_data);
+ char *link = (char *) ei->i_data;
+ link[sizeof(ei->i_data) - 1] = '\0';
+ nd_set_link(nd, link);
return NULL;
}
--
1.6.0.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists