aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs
diff options
context:
space:
mode:
authorMary <me@thog.eu>2021-10-25 00:13:20 +0200
committerGitHub <noreply@github.com>2021-10-24 19:13:20 -0300
commit51fa1b2cb0bb54c0eb235c9d1fa68a7e1abaf464 (patch)
tree8f47d8391bc4c2b994ccf872ca123fdd1dbb9288 /Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs
parentb4dc33efc2890bc0d60e99f715425d6af4a72b3d (diff)
hle: Improve safety (#2778)
* timezone: Make timezone implementation safe * hle: Do not use TrimEnd to parse ASCII strings This adds an util that handle reading an ASCII string in a safe way. Previously it was possible to read malformed data that could cause various undefined behaviours in multiple services. * hid: Remove an useless unsafe modifier on keyboard update * Address gdkchan's comment * Address gdkchan's comment
Diffstat (limited to 'Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs')
-rw-r--r--Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs2
1 files changed, 1 insertions, 1 deletions
diff --git a/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs b/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs
index dd15893a..be71bb4f 100644
--- a/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs
+++ b/Ryujinx.HLE/HOS/Services/Time/ITimeServiceManager.cs
@@ -116,7 +116,7 @@ namespace Ryujinx.HLE.HOS.Services.Time
// SetupTimeZoneManager(nn::time::LocationName location_name, nn::time::SteadyClockTimePoint timezone_update_timepoint, u32 total_location_name_count, nn::time::TimeZoneRuleVersion timezone_rule_version, buffer<nn::time::TimeZoneBinary, 0x21> timezone_binary)
public ResultCode SetupTimeZoneManager(ServiceCtx context)
{
- string locationName = Encoding.ASCII.GetString(context.RequestData.ReadBytes(0x24)).TrimEnd('\0');
+ string locationName = StringUtils.ReadInlinedAsciiString(context.RequestData, 0x24);
SteadyClockTimePoint timeZoneUpdateTimePoint = context.RequestData.ReadStruct<SteadyClockTimePoint>();
uint totalLocationNameCount = context.RequestData.ReadUInt32();
UInt128 timeZoneRuleVersion = context.RequestData.ReadStruct<UInt128>();