mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 09:46:04 -05:00
Kernel: Use Userspace<T> for the accept syscall
This commit is contained in:
parent
02660b5d60
commit
8bd9dbc220
Notes:
sideshowbarker
2024-07-19 04:05:07 +09:00
Author: https://github.com/bgianfo Commit: https://github.com/SerenityOS/serenity/commit/8bd9dbc2209 Pull-request: https://github.com/SerenityOS/serenity/pull/3062 Reviewed-by: https://github.com/awesomekling
2 changed files with 4 additions and 3 deletions
|
@ -293,7 +293,7 @@ public:
|
|||
int sys$socket(int domain, int type, int protocol);
|
||||
int sys$bind(int sockfd, Userspace<const sockaddr*> addr, socklen_t);
|
||||
int sys$listen(int sockfd, int backlog);
|
||||
int sys$accept(int sockfd, sockaddr*, socklen_t*);
|
||||
int sys$accept(int sockfd, Userspace<sockaddr*>, Userspace<socklen_t*>);
|
||||
int sys$connect(int sockfd, const sockaddr*, socklen_t);
|
||||
int sys$shutdown(int sockfd, int how);
|
||||
ssize_t sys$sendto(const Syscall::SC_sendto_params*);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue