aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2022-08-28 16:24:19 +0200
committerGitHub <noreply@github.com>2022-08-28 14:24:19 +0000
commit472a621589ebaccd8c5da93abce32a7f0105eaf6 (patch)
tree364e3d2980cf9875f7c24cfb57d3aae179bcdc1f
parent311c2661b858f6efd86d6d17603845e6778f7b2e (diff)
Bsd: Fix ArgumentOutOfRangeException in SetSocketOption (#3633)1.1.243
* Bsd: Fix ArgumentOutOfRangeException in SetSocketOption * Ensure option level is Socket before checking for SoLinger
-rw-r--r--Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs b/Ryujinx.HLE/HOS/Services/Sockets/Bsd/Impl/ManagedSocket.cs
index b9adb5cc..d2a83458 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<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));
}