diff options
author | Li Zefan <lizf@cn.fujitsu.com> | 2011-07-13 23:16:00 -0400 |
---|---|---|
committer | Chris Mason <chris.mason@oracle.com> | 2011-08-01 14:30:45 -0400 |
commit | 77906a5075a4eb767026c2e07b1a412d08aea5be (patch) | |
tree | 0d7744a53a88c0e657ba727cd69e9b694d034772 /fs/btrfs | |
parent | b783e62d9620445d1ca3de76badf0468cdd329ba (diff) |
Btrfs: copy string correctly in INO_LOOKUP ioctl
Memory areas [ptr, ptr+total_len] and [name, name+total_len]
may overlap, so it's wrong to use memcpy().
Signed-off-by: Li Zefan <lizf@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/ioctl.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index fd252fff4c6..2bb08862a4f 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -1757,11 +1757,10 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info, | |||
1757 | key.objectid = key.offset; | 1757 | key.objectid = key.offset; |
1758 | key.offset = (u64)-1; | 1758 | key.offset = (u64)-1; |
1759 | dirid = key.objectid; | 1759 | dirid = key.objectid; |
1760 | |||
1761 | } | 1760 | } |
1762 | if (ptr < name) | 1761 | if (ptr < name) |
1763 | goto out; | 1762 | goto out; |
1764 | memcpy(name, ptr, total_len); | 1763 | memmove(name, ptr, total_len); |
1765 | name[total_len]='\0'; | 1764 | name[total_len]='\0'; |
1766 | ret = 0; | 1765 | ret = 0; |
1767 | out: | 1766 | out: |