aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTSRBerry <20988865+TSRBerry@users.noreply.github.com>2022-09-02 00:04:01 +0200
committerGitHub <noreply@github.com>2022-09-01 22:04:01 +0000
commit5ff5fe47bad947a95545390865c597bec6c62070 (patch)
treed32eb4d2c9ae829db345cf0ab28c3dd6f6180a33
parent38275f90566c58f21df47df0dce0dcb4745f6590 (diff)
Bsd: Fix NullReferenceException in BsdSockAddr.FromIPEndPoint() (#3652)1.1.248
* Bsd: Fix NullReferenceException in BsdSockAddr.FromIPEndPoint() Allows "Victor Vran Overkill Edition" to boot with guest internet access enabled. Thanks to EmulationFanatic for testing this for me! * Bsd: Return proper error code if RemoteEndPoint is null * Remove whitespace from empty line Co-authored-by: gdkchan <gab.dark.100@gmail.com> Co-authored-by: gdkchan <gab.dark.100@gmail.com>
-rw-r--r--Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs16
1 files changed, 10 insertions, 6 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs b/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs
index e056e331..654844dc 100644
--- a/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs
+++ b/Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs
@@ -573,14 +573,18 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
LinuxError errno = LinuxError.EBADF;
ISocket socket = _context.RetrieveSocket(socketFd);
-
if (socket != null)
{
- errno = LinuxError.SUCCESS;
+ errno = LinuxError.ENOTCONN;
- WriteSockAddr(context, bufferPosition, socket, true);
- WriteBsdResult(context, 0, errno);
- context.ResponseData.Write(Unsafe.SizeOf<BsdSockAddr>());
+ if (socket.RemoteEndPoint != null)
+ {
+ errno = LinuxError.SUCCESS;
+
+ WriteSockAddr(context, bufferPosition, socket, true);
+ WriteBsdResult(context, 0, errno);
+ context.ResponseData.Write(Unsafe.SizeOf<BsdSockAddr>());
+ }
}
return WriteBsdResult(context, 0, errno);
@@ -903,4 +907,4 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
return WriteBsdResult(context, newSockFd, errno);
}
}
-} \ No newline at end of file
+}