Skip to content

Commit

Permalink
Update usermod_seven_segment_reloaded.h - prevent array bounds violat…
Browse files Browse the repository at this point in the history
…ion (solves #4121)

I'm not the maintainer of this usermod, but its obvious that the code might overrun array bounds, so fixing this.
  • Loading branch information
softhack007 authored Sep 6, 2024
1 parent 0642b17 commit 81cec6a
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ class UsermodSSDR : public Usermod {
}

void _setLeds(int lednr, int lastSeenLedNr, bool range, int countSegments, int number, bool colon) {
if ((lednr < 0) || (lednr >= umSSDRLength)) return; // prevent array bounds violation
if ((number < 0) || (countSegments < 0) || (lastSeenLedNr <0)) return; // prevent array out of range access

if ((colon && umSSDRColonblink) || umSSDRNumbers[number][countSegments]) {

Expand Down

0 comments on commit 81cec6a

Please sign in to comment.