forked from ShuriZma/suyu
1
0
Fork 0

time_zone_manager: Add null terminator

We aren't null-terminating this string after the copy, and we need to.
This commit is contained in:
lat9nq 2023-06-20 15:52:17 -04:00
parent fd5d7947f6
commit ae1a8a7dc7
1 changed files with 4 additions and 2 deletions

View File

@ -911,11 +911,13 @@ static Result ToCalendarTimeInternal(const TimeZoneRule& rules, s64 time,
calendar_additional_info.is_dst = rules.ttis[tti_index].is_dst;
const char* time_zone{&rules.chars[rules.ttis[tti_index].abbreviation_list_index]};
for (u32 index{}; time_zone[index] != '\0' && time_zone[index] != ',' &&
index < calendar_additional_info.timezone_name.size() - 1;
u32 index;
for (index = 0; time_zone[index] != '\0' && time_zone[index] != ',' &&
index < calendar_additional_info.timezone_name.size() - 1;
++index) {
calendar_additional_info.timezone_name[index] = time_zone[index];
}
calendar_additional_info.timezone_name[index] = '\0';
return ResultSuccess;
}