Update usermod_seven_segment_reloaded.h - prevent array bounds violation (solves #4121)

I'm not the maintainer of this usermod, but its obvious that the code might overrun array bounds, so fixing this.
This commit is contained in:
Frank 2024-09-06 19:36:24 +02:00 committed by GitHub
parent 0642b17ab0
commit 81cec6a25a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -236,6 +236,8 @@ private:
}
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]) {