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