mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 20:51:44 +00:00
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>
This commit is contained in:
parent
b783e62d96
commit
77906a5075
@ -1757,11 +1757,10 @@ static noinline int btrfs_search_path_in_tree(struct btrfs_fs_info *info,
|
||||
key.objectid = key.offset;
|
||||
key.offset = (u64)-1;
|
||||
dirid = key.objectid;
|
||||
|
||||
}
|
||||
if (ptr < name)
|
||||
goto out;
|
||||
memcpy(name, ptr, total_len);
|
||||
memmove(name, ptr, total_len);
|
||||
name[total_len]='\0';
|
||||
ret = 0;
|
||||
out:
|
||||
|
Loading…
Reference in New Issue
Block a user