Skip to content

Commit

Permalink
HTTP power meter: prevent out-of-bound array access
Browse files Browse the repository at this point in the history
  • Loading branch information
schlimmchen committed Apr 18, 2024
1 parent e92701c commit 247cfe7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/HttpPowerMeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down

0 comments on commit 247cfe7

Please sign in to comment.