[esp32_ble_server] Size the BLE2902 value buffer to its 2 byte value (#22454)

This commit is contained in:
J. Nick Koston authored and GitHub committed 2026-11-09 09:24:27 -05:00
1 parent be0550b1e8
commit 380660dcdb
1 file changed
+4 -5
@@ -3,14 +3,13 @@
#ifdef USE_ESP32
#include <cstring>
#include <esp_gatt_defs.h>
namespace esphome::esp32_ble_server {
BLE2902::BLE2902() : BLEDescriptor(esp32_ble::ESPBTUUID::from_uint16(0x2902)) {
this->value_.attr_len = 2;
uint8_t data[2] = {0, 0};
memcpy(this->value_.attr_value, data, 2);
// The client configuration value is always 2 bytes
BLE2902::BLE2902() : BLEDescriptor(esp32_ble::ESPBTUUID::from_uint16(ESP_GATT_UUID_CHAR_CLIENT_CONFIG), 2) {
this->set_value({0, 0});
}
} // namespace esphome::esp32_ble_server