mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-08-20 07:38:42 +02: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:
parent
311c2661b8
commit
472a621589
1 changed files with 7 additions and 2 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue