dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit e611cbe6db4ed9d4b9b59295857d535a049d8f5f
parent eb4d3c8b2f855fc6d3a02f4852e9c32098f807f1
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Sat, 30 Aug 2008 09:35:09 +0200

Avoid segfault when scroll_buf_sz is zero

Diffstat:
madtty.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/madtty.c b/madtty.c @@ -231,7 +231,7 @@ static void fill_scroll_buf(madtty_t *t, int s) if (t->scroll_buf_len >= t->scroll_buf_sz) t->scroll_buf_len = t->scroll_buf_sz; - if (s > 0) { + if (s > 0 && t->scroll_buf_sz) { for (int i = 0; i < s; i++) { struct t_row_t tmp = t->scroll_top[i]; t->scroll_top[i] = t->scroll_buf[t->scroll_buf_ptr]; @@ -243,7 +243,7 @@ static void fill_scroll_buf(madtty_t *t, int s) } } t_row_roll(t->scroll_top, t->scroll_bot, s); - if (s < 0) { + if (s < 0 && t->scroll_buf_sz) { for (int i = (-s)-1; i >= 0; i--) { t->scroll_buf_ptr--; if (t->scroll_buf_ptr == -1)