From 247cfe712e8279dd8f4714a590cca983a853f68c Mon Sep 17 00:00:00 2001 From: Bernhard Kirchen Date: Tue, 16 Apr 2024 22:51:00 +0200 Subject: [PATCH] HTTP power meter: prevent out-of-bound array access --- src/HttpPowerMeter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/HttpPowerMeter.cpp b/src/HttpPowerMeter.cpp index 94402fad9..798a9a2f8 100644 --- a/src/HttpPowerMeter.cpp +++ b/src/HttpPowerMeter.cpp @@ -16,6 +16,8 @@ void HttpPowerMeterClass::init() float HttpPowerMeterClass::getPower(int8_t phase) { + if (phase < 1 || phase > POWERMETER_MAX_PHASES) { return 0.0; } + return power[phase - 1]; }