1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-04 12:22:20 +01:00

[api] Fix string lifetime issue in Home Assistant service calls with templated values (#9909)

This commit is contained in:
J. Nick Koston
2025-07-27 18:39:25 -10:00
committed by GitHub
parent 05f6d01cbe
commit 1702356fc8
12 changed files with 670 additions and 25 deletions

View File

@@ -846,11 +846,11 @@ void NoiseEncryptionSetKeyResponse::calculate_size(uint32_t &total_size) const {
#ifdef USE_API_HOMEASSISTANT_SERVICES
void HomeassistantServiceMap::encode(ProtoWriteBuffer buffer) const {
buffer.encode_string(1, this->key_ref_);
buffer.encode_string(2, this->value_ref_);
buffer.encode_string(2, this->value);
}
void HomeassistantServiceMap::calculate_size(uint32_t &total_size) const {
ProtoSize::add_string_field(total_size, 1, this->key_ref_.size());
ProtoSize::add_string_field(total_size, 1, this->value_ref_.size());
ProtoSize::add_string_field(total_size, 1, this->value.size());
}
void HomeassistantServiceResponse::encode(ProtoWriteBuffer buffer) const {
buffer.encode_string(1, this->service_ref_);