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 b9adb5cc7..d2a834588 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
323 323
324 int value = optionValue.Length >= 4 ? MemoryMarshal.Read<int>(optionValue) : MemoryMarshal.Read<byte>(optionValue); 324 int value = optionValue.Length >= 4 ? MemoryMarshal.Read<int>(optionValue) : MemoryMarshal.Read<byte>(optionValue);
325 325
326 if (option == BsdSocketOption.SoLinger) 326 if (level == SocketOptionLevel.Socket && option == BsdSocketOption.SoLinger)
327 { 327 {
328 int value2 = MemoryMarshal.Read<int>(optionValue[4..]); 328 int value2 = 0;
329
330 if (optionValue.Length >= 8)
331 {
332 value2 = MemoryMarshal.Read<int>(optionValue[4..]);
333 }
329 334
330 Socket.SetSocketOption(level, SocketOptionName.Linger, new LingerOption(value != 0, value2)); 335 Socket.SetSocketOption(level, SocketOptionName.Linger, new LingerOption(value != 0, value2));
331 } 336 }