mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-08-18 06:38:42 +02:00
bsd::RecvFrom: verify output buffer size before writing socket address (#4135)
* bsd::RecvFrom: Ryujinx does not verify output buffer size before writing socket address * Calculate the size of BsdSockAddr * use bsdSockAddr variable * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs Co-authored-by: Mary-nyan <thog@protonmail.com> * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/Types/BsdSockAddr.cs Co-authored-by: Mary-nyan <thog@protonmail.com> * set errno to ENOMEM in case we can't write the address to memory * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Update Ryujinx.HLE/HOS/Services/Sockets/Bsd/IClient.cs Co-authored-by: Mary-nyan <thog@protonmail.com> Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
parent
37d27c4c99
commit
a4fdfb5f94
1 changed files with 8 additions and 1 deletions
|
@ -530,8 +530,15 @@ namespace Ryujinx.HLE.HOS.Services.Sockets.Bsd
|
||||||
|
|
||||||
receiveRegion.Dispose();
|
receiveRegion.Dispose();
|
||||||
|
|
||||||
|
if (sockAddrOutSize != 0 && sockAddrOutSize >= (ulong) Unsafe.SizeOf<BsdSockAddr>())
|
||||||
|
{
|
||||||
context.Memory.Write(sockAddrOutPosition, BsdSockAddr.FromIPEndPoint(endPoint));
|
context.Memory.Write(sockAddrOutPosition, BsdSockAddr.FromIPEndPoint(endPoint));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
errno = LinuxError.ENOMEM;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return WriteBsdResult(context, result, errno);
|
return WriteBsdResult(context, result, errno);
|
||||||
|
|
Loading…
Reference in a new issue