Size the stack copy from the table's MAX_LENGTH

This commit is contained in:
J. Nick Koston
2026-10-13 11:17:13 -10:00
parent c7583a77fb
commit 21a1cc9762
@@ -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);
}