2007-06-08 07:59:14

by Chris Wright

[permalink] [raw]
Subject: [patch 22/54] ntfs_init_locked_inode(): fix array indexing

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

From: Andrew Morton <[email protected]>

Local variable `i' is a byte-counter. Don't use it as an index into an array
of le32's.

Reported-by: "young dave" <[email protected]>
Cc: "Christoph Lameter" <[email protected]>
Acked-by: Anton Altaparmakov <[email protected]>
Cc: <[email protected]>
Cc: Adrian Bunk <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Signed-off-by: Chris Wright <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
---
fs/ntfs/inode.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.21.4.orig/fs/ntfs/inode.c
+++ linux-2.6.21.4/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;
}

--