Skip to content

Commit 19f4775

Browse files
committed
Merge branch 'backport_more_str_fixes_1_2' into 'release/v1.2'
[v1.2] Fix battery replacement description and active locale attributes See merge request app-frameworks/esp-matter!660
2 parents 5fbdfbf + 468f2d8 commit 19f4775

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

components/esp_matter/esp_matter_attribute.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -3307,9 +3307,13 @@ namespace attribute {
33073307

33083308
attribute_t *create_active_locale(cluster_t *cluster, char *value, uint16_t length)
33093309
{
3310+
if (length > k_max_active_locale_length) {
3311+
ESP_LOGE(TAG, "Could not create attribute, string length out of bound");
3312+
return NULL;
3313+
}
33103314
return esp_matter::attribute::create(cluster, LocalizationConfiguration::Attributes::ActiveLocale::Id,
33113315
ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE,
3312-
esp_matter_char_str(value, length));
3316+
esp_matter_char_str(value, length), k_max_active_locale_length);
33133317
}
33143318

33153319
attribute_t *create_supported_locales(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)
@@ -3831,7 +3835,7 @@ attribute_t *create_active_bat_faults(cluster_t *cluster, uint8_t * value, uint1
38313835

38323836
attribute_t *create_bat_replacement_description(cluster_t *cluster, const char * value, uint16_t length)
38333837
{
3834-
if (length > k_max_description_length) {
3838+
if (length > k_max_bat_replacement_description_length) {
38353839
ESP_LOGE(TAG, "Could not create attribute, string size out of bound");
38363840
return NULL;
38373841
}

0 commit comments

Comments
 (0)