mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-06 09:00:17 +02:00
x32/Info: Only modify output in getrlimit/ugetrlimit if successful
Avoids trampling over input data.
This commit is contained in:
1 parent
5f2d19c7aa
commit
d206b67ca8
1 file changed
+8
-4
@@ -99,8 +99,10 @@ void RegisterInfo(FEX::HLE::SyscallHandler* Handler) {
|
||||
getrlimit, [](FEXCore::Core::CpuStateFrame* Frame, int resource, compat_ptr<FEX::HLE::x32::rlimit32<true>> rlim) -> uint64_t {
|
||||
struct rlimit rlim64 {};
|
||||
uint64_t Result = ::getrlimit(resource, &rlim64);
|
||||
FaultSafeUserMemAccess::VerifyIsWritable(rlim, sizeof(*rlim));
|
||||
*rlim = rlim64;
|
||||
if (Result != -1) {
|
||||
FaultSafeUserMemAccess::VerifyIsWritable(rlim, sizeof(*rlim));
|
||||
*rlim = rlim64;
|
||||
}
|
||||
SYSCALL_ERRNO();
|
||||
});
|
||||
|
||||
@@ -108,8 +110,10 @@ void RegisterInfo(FEX::HLE::SyscallHandler* Handler) {
|
||||
ugetrlimit, [](FEXCore::Core::CpuStateFrame* Frame, int resource, compat_ptr<FEX::HLE::x32::rlimit32<false>> rlim) -> uint64_t {
|
||||
struct rlimit rlim64 {};
|
||||
uint64_t Result = ::getrlimit(resource, &rlim64);
|
||||
FaultSafeUserMemAccess::VerifyIsWritable(rlim, sizeof(*rlim));
|
||||
*rlim = rlim64;
|
||||
if (Result != -1) {
|
||||
FaultSafeUserMemAccess::VerifyIsWritable(rlim, sizeof(*rlim));
|
||||
*rlim = rlim64;
|
||||
}
|
||||
SYSCALL_ERRNO();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user