@@ -545,10 +545,11 @@ CHIP_ERROR TimeSynchronizationServer::SetTimeZone(const DataModel::DecodableList
545
545
{
546
546
const TimeSyncDataProvider::TimeZoneStore & tzStore = GetTimeZone ()[0 ];
547
547
lastTz.offset = tzStore.timeZone .offset ;
548
- if (tzStore.timeZone .name .HasValue () && sizeof (name) >= sizeof (tzStore.name ))
548
+ chip::MutableCharSpan tempSpan (name, sizeof (name));
549
+ if (tzStore.timeZone .name .HasValue () &&
550
+ CHIP_NO_ERROR == CopyCharSpanToMutableCharSpan (tzStore.timeZone .name .Value (), tempSpan))
549
551
{
550
- lastTz.name .SetValue (CharSpan (name));
551
- memcpy (name, tzStore.name , sizeof (tzStore.name ));
552
+ lastTz.name .SetValue (CharSpan (tempSpan.data (), tempSpan.size ()));
552
553
}
553
554
}
554
555
@@ -649,7 +650,6 @@ CHIP_ERROR TimeSynchronizationServer::ClearTimeZone()
649
650
{
650
651
InitTimeZone ();
651
652
ReturnErrorOnFailure (mTimeSyncDataProvider .StoreTimeZone (GetTimeZone ()));
652
- emitTimeZoneStatusEvent (GetDelegate ()->GetEndpoint ());
653
653
return CHIP_NO_ERROR;
654
654
}
655
655
@@ -693,7 +693,7 @@ CHIP_ERROR TimeSynchronizationServer::SetDSTOffset(const DataModel::DecodableLis
693
693
694
694
for (i = 0 ; i < mDstOffsetObj .validSize ; i++)
695
695
{
696
- const auto & dstItem = GetDSTOffset () [i];
696
+ const auto & dstItem = mDstOffsetObj . dstOffsetList [i];
697
697
// list should be sorted by validStarting
698
698
// validUntil shall be larger than validStarting
699
699
if (!dstItem.validUntil .IsNull () && dstItem.validStarting >= dstItem.validUntil .Value ())
0 commit comments