diff --git a/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp b/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp index 86fe44249614f6..257676cea7d6bc 100644 --- a/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp +++ b/src/app/clusters/localization-configuration-server/localization-configuration-server.cpp @@ -39,6 +39,8 @@ using namespace chip::app::Clusters::LocalizationConfiguration::Attributes; namespace { +constexpr size_t kMaxActiveLocaleLength = 35; + class LocalizationConfigurationAttrAccess : public AttributeAccessInterface { public: @@ -150,7 +152,9 @@ void emberAfLocalizationConfigurationClusterServerInitCallback(EndpointId endpoi { DeviceLayer::AttributeList supportedLocales; CharSpan validLocale; - MutableCharSpan activeLocale; + + char outBuffer[kMaxActiveLocaleLength]; + MutableCharSpan activeLocale(outBuffer); EmberAfStatus status = ActiveLocale::Get(endpoint, activeLocale); VerifyOrReturn(EMBER_ZCL_STATUS_SUCCESS == status, ChipLogError(Zcl, "Failed to read ActiveLocale with error: 0x%02x", status));