1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 23:38:12 +00:00

Kernel: Truncate addresses stored by getsockname() and getpeername()

If there's not enough space in the output buffer for the whole sockaddr
we now simply truncate the address instead of returning EINVAL.

This patch also makes getpeername() actually return the peer address
rather than the local address.. :^)
This commit is contained in:
Andreas Kling 2020-02-07 23:42:28 +01:00
parent d34ad44f90
commit d04fcccc90
6 changed files with 23 additions and 38 deletions

View file

@ -49,8 +49,8 @@ public:
virtual KResult bind(const sockaddr*, socklen_t) override;
virtual KResult connect(FileDescription&, const sockaddr*, socklen_t, ShouldBlock = ShouldBlock::Yes) override;
virtual KResult listen(int) override;
virtual bool get_local_address(sockaddr*, socklen_t*) override;
virtual bool get_peer_address(sockaddr*, socklen_t*) override;
virtual void get_local_address(sockaddr*, socklen_t*) override;
virtual void get_peer_address(sockaddr*, socklen_t*) override;
virtual void attach(FileDescription&) override;
virtual void detach(FileDescription&) override;
virtual bool can_read(const FileDescription&) const override;