[patch 18/32] ntfs_init_locked_inode(): fix array indexing

Chris Wright
2007-06-08T07:28:01Z

[-- Attachment #1: ntfs_init_locked_inode-fix-array-indexing.patch --]
[-- Type: text/plain, Size: 970 bytes --]

-stable review patch. If anyone has any objections, please let us know.
---------------------

From: Andrew Morton <akpm@linux-foundation.org>

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>
Cc: "Christoph Lameter" <clameter@sgi.com>
Acked-by: Anton Altaparmakov <aia21@cantab.net>
Cc: <stable@kernel.org>
Cc: Adrian Bunk <bunk@stusta.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
---
fs/ntfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.20.13.orig/fs/ntfs/inode.c
+++ linux-2.6.20.13/fs/ntfs/inode.c
@@ -141,7 +141,7 @@ static int ntfs_init_locked_inode(struct
if (!ni->name)
return -ENOMEM;
memcpy(ni->name, na->name, i);
- ni->name[i] = 0;
+ ni->name[na->name_len] = 0;
}
return 0;
}

--