From 1cfe49714f2f108c20ccee96d23e7e1005a2e68e Mon Sep 17 00:00:00 2001 From: Simon Arlott <70171+nomis@users.noreply.github.com> Date: Sat, 16 Apr 2022 18:40:48 +0100 Subject: rgblight: Limit max repeat times in rgblight_blink_layer_repeat (#16860) --- quantum/rgblight/rgblight.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'quantum/rgblight') diff --git a/quantum/rgblight/rgblight.c b/quantum/rgblight/rgblight.c index 8f933a6e51..f4ddb81e92 100644 --- a/quantum/rgblight/rgblight.c +++ b/quantum/rgblight/rgblight.c @@ -813,6 +813,10 @@ void rgblight_blink_layer(uint8_t layer, uint16_t duration_ms) { } void rgblight_blink_layer_repeat(uint8_t layer, uint16_t duration_ms, uint8_t times) { + if (times > UINT8_MAX / 2) { + times = UINT8_MAX / 2; + } + _times_remaining = times * 2; _dur = duration_ms; -- cgit v1.2.3