#2967: getpeername() succeeds on unconnected sockets
--------------------------------------+---------------------------
Reporter: bonefish | Owner: phoudoin
Type: bug | Status: assigned
Priority: normal | Milestone: R1
Component: Network & Internet/TCP | Version: R1/pre-alpha1
Resolution: | Keywords:
Blocked By: | Blocking:
Has a Patch: 0 | Platform: All
--------------------------------------+---------------------------
Comment (by phoudoin):
An easy fix is in src/add-ons/kernel/network/stack/net_socket.cpp
{{{
status_t
socket_getpeername(net_socket* _socket)
{
net_socket_private* socket = (net_socket_private*)_socket;
if (!socket->is_connected)
return ENOTCONN;
...
}
}}}
Not great though, in the public socket API part of this module,
net_socket_private is supposed to be unknown.
--
Ticket URL: <https://dev.haiku-os.org/ticket/2967#comment:2>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.