projects/linux·commit 1fc799e1

ntfs_init_locked_inode(): fix array indexing

1fc799e1 · Andrew Morton <[email protected]> · 2007-05-31 00:40:49 -07:00

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]>
Commit
1fc799e1b4efdbc405d87d9f154d64d9bc299e5c
Parents
ebdf7d39

Changes

1 files changed · +1 −1

FileStatusAddDelContent
fs/ntfs/inode.cmodified+1−1View file

fs/ntfs/inode.c

View file
diff --git a/fs/ntfs/inode.c b/fs/ntfs/inode.c
index 074791c..b532a73 100644
--- a/fs/ntfs/inode.c
+++ b/fs/ntfs/inode.c
@@ -140,7 +140,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;
}