From 6003344cd61c5f2059ccf8b8f74442b0c20096d0 Mon Sep 17 00:00:00 2001 From: Paul Date: Sun, 6 Oct 2019 22:04:10 +0200 Subject: [PATCH] fix out of bounds with hc num --- src/ems.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ems.cpp b/src/ems.cpp index 5e363f35b..2f3b74a7b 100644 --- a/src/ems.cpp +++ b/src/ems.cpp @@ -1489,7 +1489,7 @@ void _process_EasyStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) { void _process_MMPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) { uint8_t hc = (EMS_RxTelegram->type - EMS_TYPE_MMPLUSStatusMessage_HC1); // 0 to 3 - if (hc > EMS_THERMOSTAT_MAXHC) { + if (hc >= EMS_THERMOSTAT_MAXHC) { return; // invalid type } EMS_Mixing.hc[hc].active = true; @@ -1507,7 +1507,7 @@ void _process_MMPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) { void _process_RCPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) { // figure out which heating circuit uint8_t hc = (EMS_RxTelegram->type - EMS_TYPE_RCPLUSStatusMessage_HC1); // 0 to 3 - if (hc > EMS_THERMOSTAT_MAXHC) { + if (hc >= EMS_THERMOSTAT_MAXHC) { return; // invalid type } EMS_Thermostat.hc[hc].active = true;