mirror of
https://github.com/esphome/esphome.git
synced 2026-10-14 10:12:52 +00:00
Size the stack copy from the table's MAX_LENGTH
This commit is contained in:
@@ -22,9 +22,8 @@ void MicroNovaTextSensor::process_value_from_stove(int value_from_stove) {
|
||||
// Values past the table read as "Undefined alarm"
|
||||
const ProgmemStr name =
|
||||
StoveStateStrings::get_progmem_str(static_cast<uint8_t>(value_from_stove), StoveStateStrings::LAST_INDEX);
|
||||
char text[20];
|
||||
char text[StoveStateStrings::MAX_LENGTH + 1];
|
||||
ESPHOME_strncpy_P(text, reinterpret_cast<ESPHOME_PGM_P>(name), sizeof(text));
|
||||
text[sizeof(text) - 1] = '\0';
|
||||
this->publish_state(text);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user