fix out of bounds with hc num

This commit is contained in:
Paul
2019-10-06 22:04:10 +02:00
parent a5719800a3
commit 6003344cd6

View File

@@ -1489,7 +1489,7 @@ void _process_EasyStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
void _process_MMPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) { void _process_MMPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
uint8_t hc = (EMS_RxTelegram->type - EMS_TYPE_MMPLUSStatusMessage_HC1); // 0 to 3 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 return; // invalid type
} }
EMS_Mixing.hc[hc].active = true; EMS_Mixing.hc[hc].active = true;
@@ -1507,7 +1507,7 @@ void _process_MMPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
void _process_RCPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) { void _process_RCPLUSStatusMessage(_EMS_RxTelegram * EMS_RxTelegram) {
// figure out which heating circuit // figure out which heating circuit
uint8_t hc = (EMS_RxTelegram->type - EMS_TYPE_RCPLUSStatusMessage_HC1); // 0 to 3 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 return; // invalid type
} }
EMS_Thermostat.hc[hc].active = true; EMS_Thermostat.hc[hc].active = true;