From 0efc0610f3c34fbe7d5a66a2bcb3220bada08a47 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Wed, 14 Aug 2019 16:00:12 -0400 Subject: Behave like ICH in IRM This should fix another OOB bug. --- term.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/term.c b/term.c index 178e613..a7e53bf 100644 --- a/term.c +++ b/term.c @@ -328,7 +328,8 @@ ACTION(add) { } if (t->mode & Insert) { - move(C(Y, X + width), C(Y, X), t->cols - X - width); + uint n = MIN((uint)width, t->cols - X); + move(C(Y, X + n), C(Y, X), t->cols - X - n); } if (t->mode & Wrap && X + width > t->cols) { cr(t, ch); -- cgit 1.4.1