diff options
author | Brian Gianforcaro <b.gianfo@gmail.com> | 2020-08-09 15:23:13 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-10 12:52:15 +0200 |
commit | 8bd9dbc220963f0cde6ec055ba833d498c234dda (patch) | |
tree | b159f6ebc46c17c8c169d19b96b42de7c43c865b /Kernel/Syscalls/socket.cpp | |
parent | 02660b5d60ab677463ad786002ee91eeed8a197c (diff) | |
download | serenity-8bd9dbc220963f0cde6ec055ba833d498c234dda.zip |
Kernel: Use Userspace<T> for the accept syscall
Diffstat (limited to 'Kernel/Syscalls/socket.cpp')
-rw-r--r-- | Kernel/Syscalls/socket.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Kernel/Syscalls/socket.cpp b/Kernel/Syscalls/socket.cpp index f63b870f31..b7112a25b6 100644 --- a/Kernel/Syscalls/socket.cpp +++ b/Kernel/Syscalls/socket.cpp @@ -93,7 +93,7 @@ int Process::sys$listen(int sockfd, int backlog) return socket.listen(backlog); } -int Process::sys$accept(int accepting_socket_fd, sockaddr* user_address, socklen_t* user_address_size) +int Process::sys$accept(int accepting_socket_fd, Userspace<sockaddr*> user_address, Userspace<socklen_t*> user_address_size) { REQUIRE_PROMISE(accept); @@ -101,7 +101,8 @@ int Process::sys$accept(int accepting_socket_fd, sockaddr* user_address, socklen if (user_address) { if (!validate_write_typed(user_address_size)) return -EFAULT; - copy_from_user(&address_size, user_address_size); + if (!validate_read_and_copy_typed(&address_size, user_address_size)) + return -EFAULT; if (!validate_write(user_address, address_size)) return -EFAULT; } |