diff options
-rw-r--r-- | Kernel/Net/LocalSocket.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Net/LocalSocket.cpp b/Kernel/Net/LocalSocket.cpp index 8de56c6545..1bae224909 100644 --- a/Kernel/Net/LocalSocket.cpp +++ b/Kernel/Net/LocalSocket.cpp @@ -124,11 +124,11 @@ void LocalSocket::get_peer_address(sockaddr* address, socklen_t* address_size) ErrorOr<void> LocalSocket::bind(Userspace<sockaddr const*> user_address, socklen_t address_size) { VERIFY(setup_state() == SetupState::Unstarted); - if (address_size != sizeof(sockaddr_un)) + if (address_size > sizeof(sockaddr_un)) return set_so_error(EINVAL); sockaddr_un address = {}; - SOCKET_TRY(copy_from_user(&address, user_address, sizeof(sockaddr_un))); + SOCKET_TRY(copy_from_user(&address, user_address, address_size)); if (address.sun_family != AF_LOCAL) return set_so_error(EINVAL); |