-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug.Assert when using ReceiveFrom on UnixDomainSocket #78448
Comments
Tagging subscribers to this area: @dotnet/ncl Issue DetailsI was adding new test like using (Socket server = new Socket(AddressFamily.Unix, SocketType.Dgram, ProtocolType.Unspecified))
{
server.Bind(new UnixDomainSocketEndPoint(serverAddress));
using (Socket client = new Socket(AddressFamily.Unix, SocketType.Dgram, ProtocolType.Unspecified))
{
byte[] data = Encoding.ASCII.GetBytes(nameof(UnixDomainSocketEndPoint_SendToReceiveFrom_CorrectEndPoint));
// Bind the client.
client.Bind(new UnixDomainSocketEndPoint(clientAddress));
var sender = new UnixDomainSocketEndPoint(GetRandomNonExistingFilePath());
EndPoint senderRemote = (EndPoint)sender;
client.SendTo(data, server.LocalEndPoint);
byte[] buffer = new byte[data.Length * 2];
int receivedBytes = server.ReceiveFrom(buffer, ref senderRemote);
}
} and it will produce core with
While
We seems to serialize only the actual size of the Since the
|
I was adding new test like
and it will produce core with
While
sockaddr_un
has fixed size the actualpath
can varyWe seems to serialize only the actual size of the
EndPoint
so unless caller always creates string with maximum platform size they may have problems. (production code truncates the address)Since the
EndPoint
is passed in asref
to be filled in it should not matter what the endpoint was. It would be nice if one could simply create emptyUnixDomainSocketEndPoint
fromstring.Empty
but that fails in constructor.The text was updated successfully, but these errors were encountered: