mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:38:11 +00:00
Kernel/Syscalls: Use copy_n_to_user when applicable
copy_to_user() with bytes as the last argument could be changed to using copy_n_to_user() with a count.
This commit is contained in:
parent
f32fde6152
commit
d0ac24ddbf
5 changed files with 10 additions and 9 deletions
|
@ -428,7 +428,7 @@ ErrorOr<FlatPtr> Process::sys$socketpair(Userspace<Syscall::SC_socketpair_params
|
|||
setup_socket_fd(fds, allocated_fds[0], pair.description0, params.type);
|
||||
setup_socket_fd(fds, allocated_fds[1], pair.description1, params.type);
|
||||
|
||||
if (copy_to_user(params.sv, allocated_fds, sizeof(allocated_fds)).is_error()) {
|
||||
if (copy_n_to_user(params.sv, allocated_fds, 2).is_error()) {
|
||||
// Avoid leaking both file descriptors on error.
|
||||
fds[allocated_fds[0]] = {};
|
||||
fds[allocated_fds[1]] = {};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue