diff --git a/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs b/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs index b9adb5cc77..d2a8345887 100644 --- a/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs +++ b/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs @@ -323,9 +323,14 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd int value = optionValue.Length >= 4 ? MemoryMarshal.Read(optionValue) : MemoryMarshal.Read(optionValue); - if (option == BsdSocketOption.SoLinger) + if (level == SocketOptionLevel.Socket && option == BsdSocketOption.SoLinger) { - int value2 = MemoryMarshal.Read(optionValue[4..]); + int value2 = 0; + + if (optionValue.Length >= 8) + { + value2 = MemoryMarshal.Read(optionValue[4..]); + } Socket.SetSocketOption(level, SocketOptionName.Linger, new LingerOption(value != 0, value2)); }