mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-24 10:22:05 -05:00
Kernel: Use try_copy_kstring_from_user() in sys$link()
This commit is contained in:
parent
5b13af0edd
commit
95669fa861
1 changed files with 7 additions and 7 deletions
|
@ -17,13 +17,13 @@ KResultOr<FlatPtr> Process::sys$link(Userspace<const Syscall::SC_link_params*> u
|
|||
Syscall::SC_link_params params;
|
||||
if (!copy_from_user(¶ms, user_params))
|
||||
return EFAULT;
|
||||
auto old_path = copy_string_from_user(params.old_path);
|
||||
if (old_path.is_null())
|
||||
return EFAULT;
|
||||
auto new_path = copy_string_from_user(params.new_path);
|
||||
if (new_path.is_null())
|
||||
return EFAULT;
|
||||
return VirtualFileSystem::the().link(old_path, new_path, current_directory());
|
||||
auto old_path_or_error = try_copy_kstring_from_user(params.old_path);
|
||||
if (old_path_or_error.is_error())
|
||||
return old_path_or_error.error();
|
||||
auto new_path_or_error = try_copy_kstring_from_user(params.new_path);
|
||||
if (new_path_or_error.is_error())
|
||||
return new_path_or_error.error();
|
||||
return VirtualFileSystem::the().link(old_path_or_error.value()->view(), new_path_or_error.value()->view(), current_directory());
|
||||
}
|
||||
|
||||
KResultOr<FlatPtr> Process::sys$symlink(Userspace<const Syscall::SC_symlink_params*> user_params)
|
||||
|
|
Loading…
Add table
Reference in a new issue