0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-23 04:05:46 +00:00

Bsd: Fix ArgumentOutOfRangeException in SetSocketOption (#3633)

* Bsd: Fix ArgumentOutOfRangeException in SetSocketOption

* Ensure option level is Socket before checking for SoLinger
This commit is contained in:
TSRBerry 2022-08-28 16:24:19 +02:00 committed by GitHub
parent 311c2661b8
commit 472a621589
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -323,9 +323,14 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
int value = optionValue.Length >= 4 ? MemoryMarshal.Read<int>(optionValue) : MemoryMarshal.Read<byte>(optionValue);
if (option == BsdSocketOption.SoLinger)
if (level == SocketOptionLevel.Socket && option == BsdSocketOption.SoLinger)
{
int value2 = MemoryMarshal.Read<int>(optionValue[4..]);
int value2 = 0;
if (optionValue.Length >= 8)
{
value2 = MemoryMarshal.Read<int>(optionValue[4..]);
}
Socket.SetSocketOption(level, SocketOptionName.Linger, new LingerOption(value != 0, value2));
}