dvtm

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

commit 74b6b27cc2d9bdaf3c0674e3c99fc26337721fd4
parent 68a105e5b0d1997d5863976bcab77127e245b671
Author: Marc André Tanner <mat@brain-dump.org>
Date:   Tue, 17 Feb 2015 22:34:38 +0100

Fix abortion criteria in CSI parameter parsing logic

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

diff --git a/vt.c b/vt.c @@ -81,7 +81,7 @@ #define IS_CONTROL(ch) !((ch) & 0xffffff60UL) #define MIN(x, y) ((x) < (y) ? (x) : (y)) -#define sstrlen(str) (sizeof(str) - 1) +#define LENGTH(arr) (sizeof(arr) / sizeof((arr)[0])) static bool is_utf8, has_default_colors; static short color_pairs_reserved, color_pairs_max, color_pair_current; @@ -968,9 +968,9 @@ static void interpret_csi_priv_mode(Vt *t, int param[], int pcount, bool set) static void interpret_csi(Vt *t) { - static int csiparam[BUFSIZ]; Buffer *b = t->buffer; - int param_count = 0; + int csiparam[16]; + unsigned int param_count = 0; const char *p = t->ebuf + 1; char verb = t->ebuf[t->elen - 1]; @@ -979,7 +979,7 @@ static void interpret_csi(Vt *t) if (IS_CONTROL(*p)) { process_nonprinting(t, *p); } else if (*p == ';') { - if (param_count >= (int)sizeof(csiparam)) + if (param_count >= LENGTH(csiparam)) return; /* too long! */ csiparam[param_count++] = 0; } else if (isdigit((unsigned char)*p)) {