mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +00:00
Kernel: Don't try to copy empty Vector in sys$recvmsg
If there's no fds to copy in a message with proper space for an SCM_RIGHTS set of cmsg headers, then don't try to copy them. This avoids a Kernel panic when recvmsg-ing, as copy_to_user(p, 0, 0) hits a VERIFY.
This commit is contained in:
@@ -322,6 +322,7 @@ ErrorOr<FlatPtr> Process::sys$recvmsg(int sockfd, Userspace<struct msghdr*> user
|
|||||||
m_fds.with_exclusive([&](auto& fds) { fds[fd_allocation.fd].set(*description, 0); });
|
m_fds.with_exclusive([&](auto& fds) { fds[fd_allocation.fd].set(*description, 0); });
|
||||||
fdnums.append(fd_allocation.fd);
|
fdnums.append(fd_allocation.fd);
|
||||||
}
|
}
|
||||||
|
if (!fdnums.is_empty())
|
||||||
TRY(try_add_cmsg(SOL_SOCKET, SCM_RIGHTS, fdnums.data(), fdnums.size() * sizeof(int)));
|
TRY(try_add_cmsg(SOL_SOCKET, SCM_RIGHTS, fdnums.data(), fdnums.size() * sizeof(int)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user