]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ntfs_init_locked_inode(): fix array indexing
authorAndrew Morton <akpm@linux-foundation.org>
Sun, 22 Jul 2007 14:09:40 +0000 (16:09 +0200)
committerAdrian Bunk <bunk@stusta.de>
Sun, 22 Jul 2007 14:09:40 +0000 (16:09 +0200)
Local variable `i' is a byte-counter.  Don't use it as an index into an array
of le32's.

Reported-by: "young dave" <hidave.darkstar@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
fs/ntfs/inode.c

index 55263b7de9c00ef6ac55cc26701ede1677cf1e18..409581aa3eebca123584dd522106917f0371b413 100644 (file)
@@ -135,7 +135,7 @@ static int ntfs_init_locked_inode(struct inode *vi, ntfs_attr *na)
                if (!ni->name)
                        return -ENOMEM;
                memcpy(ni->name, na->name, i);
-               ni->name[i] = 0;
+               ni->name[na->name_len] = 0;
        }
        return 0;
 }