ui/console-vc: fix off-by-one in CSI J 2 (clear entire screen)
The loop condition used `y <= s->height` instead of `y < s->height`, causing vc_clear_xy() to be called with y == s->height. This clears a row in the scrollback buffer beyond the visible screen. Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Marc-André Lureau committed
Feb 22, 2026 at 23:24 UTC
181fdf8a7e13c0460a26777ff9301e0ecdca3784
1 file changed
+1
-1
ui/console-vc.c
+1
-1
@@ -899,7 +899,7 @@ static void vc_putchar(VCChardev *vc, int ch)
899
break;
900
case 2:
901
/* clear entire screen */
902
- for (y = 0; y <= s->height; y++) {
902
+ for (y = 0; y < s->height; y++) {
903
for (x = 0; x < s->width; x++) {
904
vc_clear_xy(vc, x, y);
905
}