lkml.org 
[lkml]   [2008]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH] ext2: ensure link targets are NULL-terminated
    Date
    Ensure link targets are NULL-terminated, even if corrupted on-disk.

    Signed-off-by: Duane Griffin <duaneg@dghda.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


    \
     
     \ /
      Last update: 2008-12-11 20:19    [W:0.018 / U:362.904 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site