diff options
author | Brian Gianforcaro <b.gianfo@gmail.com> | 2020-08-18 00:25:23 -0700 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-19 21:05:28 +0200 |
commit | 8e97de2df9fa657832102cc637e1db4f038bb6e5 (patch) | |
tree | 9bb07d92bd6e9e4db73b45b36bb169361a2b1198 /Kernel/Net/IPv4Socket.h | |
parent | 9f9b05ba0f8d907ab3190b127ef4500c1ad08156 (diff) | |
download | serenity-8e97de2df9fa657832102cc637e1db4f038bb6e5.zip |
Kernel: Use Userspace<T> for the recvfrom syscall, and Socket implementation
This fixes a bunch of unchecked kernel reads and writes, seems like they
would might exploitable :). Write of sockaddr_in size to any address you
please...
Diffstat (limited to 'Kernel/Net/IPv4Socket.h')
-rw-r--r-- | Kernel/Net/IPv4Socket.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Kernel/Net/IPv4Socket.h b/Kernel/Net/IPv4Socket.h index 6b7180831b..cb513247ac 100644 --- a/Kernel/Net/IPv4Socket.h +++ b/Kernel/Net/IPv4Socket.h @@ -59,7 +59,7 @@ public: virtual bool can_read(const FileDescription&, size_t) const override; virtual bool can_write(const FileDescription&, size_t) const override; virtual KResultOr<size_t> sendto(FileDescription&, const void*, size_t, int, Userspace<const sockaddr*>, socklen_t) override; - virtual KResultOr<size_t> recvfrom(FileDescription&, void*, size_t, int flags, sockaddr*, socklen_t*) override; + virtual KResultOr<size_t> recvfrom(FileDescription&, void*, size_t, int flags, Userspace<sockaddr*>, Userspace<socklen_t*>) override; virtual KResult setsockopt(int level, int option, Userspace<const void*>, socklen_t) override; virtual KResult getsockopt(FileDescription&, int level, int option, Userspace<void*>, Userspace<socklen_t*>) override; @@ -110,8 +110,8 @@ protected: private: virtual bool is_ipv4() const override { return true; } - KResultOr<size_t> receive_byte_buffered(FileDescription&, void* buffer, size_t buffer_length, int flags, sockaddr*, socklen_t*); - KResultOr<size_t> receive_packet_buffered(FileDescription&, void* buffer, size_t buffer_length, int flags, sockaddr*, socklen_t*); + KResultOr<size_t> receive_byte_buffered(FileDescription&, void* buffer, size_t buffer_length, int flags, Userspace<sockaddr*>, Userspace<socklen_t*>); + KResultOr<size_t> receive_packet_buffered(FileDescription&, void* buffer, size_t buffer_length, int flags, Userspace<sockaddr*>, Userspace<socklen_t*>); IPv4Address m_local_address; IPv4Address m_peer_address; |