From 3dbf8a0fd1d69c8400ac3536e6503336e5c9d95e Mon Sep 17 00:00:00 2001 From: MichaelDvP Date: Wed, 15 Nov 2023 11:31:51 +0100 Subject: [PATCH] fix crash on wrong input for switchtime --- src/devices/thermostat.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/devices/thermostat.cpp b/src/devices/thermostat.cpp index 9573c7bc7..284dc3e6f 100644 --- a/src/devices/thermostat.cpp +++ b/src/devices/thermostat.cpp @@ -2919,7 +2919,7 @@ bool Thermostat::set_switchtime(const char * value, const uint16_t type_id, char min_on = 0; max_on = 1; } - if (no > 41 || time > 0x90 || ((on < min_on || on > max_on) && on != 7)) { + if (no > 41 || time > 0x90 || day > 7 || ((on < min_on || on > max_on) && on != 7)) { // LOG_WARNING("Setting switchtime: Invalid data: %s", value); // LOG_WARNING("Setting switchtime: Invalid data: %02d.%1d.0x%02X.%1d", no, day, time, on); return false;