From b4ae5af588ec90ca5f62910d337682e2ece21c71 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 2 Mar 2019 06:35:49 +0000 Subject: [PATCH] add_cc: use sgrowarray when growing the line size. Somehow missed this one in commit e0a76971c. --- terminal.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/terminal.c b/terminal.c index 4f6776c8..8141ffaf 100644 --- a/terminal.c +++ b/terminal.c @@ -213,8 +213,12 @@ static void add_cc(termline *line, int col, unsigned long chr) */ if (!line->cc_free) { int n = line->size; - line->size += 16 + (line->size - line->cols) / 2; - line->chars = sresize(line->chars, line->size, termchar); + + size_t tmpsize = line->size; + sgrowarray(line->chars, tmpsize, tmpsize); + assert(tmpsize <= INT_MAX); + line->size = tmpsize; + line->cc_free = n; while (n < line->size) { if (n+1 < line->size)