From 4b50db0e99d8fb252c18ce824668331679d59dca Mon Sep 17 00:00:00 2001 From: Shubham Patil Date: Sun, 10 Mar 2024 15:49:29 +0530 Subject: [PATCH] Fix active locale attributes --- components/esp_matter/esp_matter_attribute.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/components/esp_matter/esp_matter_attribute.cpp b/components/esp_matter/esp_matter_attribute.cpp index f0c1e9c02..2b508293c 100644 --- a/components/esp_matter/esp_matter_attribute.cpp +++ b/components/esp_matter/esp_matter_attribute.cpp @@ -1869,9 +1869,13 @@ namespace attribute { attribute_t *create_active_locale(cluster_t *cluster, char *value, uint16_t length) { + if (length > k_max_active_locale_length) { + ESP_LOGE(TAG, "Could not create attribute, string length out of bound"); + return NULL; + } return esp_matter::attribute::create(cluster, LocalizationConfiguration::Attributes::ActiveLocale::Id, ATTRIBUTE_FLAG_WRITABLE | ATTRIBUTE_FLAG_NONVOLATILE, - esp_matter_char_str(value, length)); + esp_matter_char_str(value, length), k_max_active_locale_length); } attribute_t *create_supported_locales(cluster_t *cluster, uint8_t *value, uint16_t length, uint16_t count)