Kernel: Allow sys$bind() on local sockets with short socket address
Previously, we required local socket addresses to be exactly sizeof(sockaddr_un). There was no real reason for this, so let's not enforce it.
This commit is contained in:
parent
8e9676c28c
commit
5e4d5a436e
Notes:
sideshowbarker
2024-07-17 11:36:52 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/5e4d5a436e
1 changed files with 2 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Reference in a new issue