osc: allocate data buffer dynamically

This commit is contained in:
Daniel Eklöf 2019-07-19 08:59:35 +02:00
parent 95ff37afd7
commit 153628a217
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
5 changed files with 30 additions and 4 deletions

9
vt.c
View file

@ -909,12 +909,15 @@ action(struct terminal *term, enum action _action, uint8_t c)
break;
case ACTION_OSC_PUT:
if (term->vt.osc.idx < (int)sizeof(term->vt.osc.data) - 1)
term->vt.osc.data[term->vt.osc.idx++] = c;
if (!osc_ensure_size(term, term->vt.osc.idx + 1))
break;
term->vt.osc.data[term->vt.osc.idx++] = c;
break;
case ACTION_OSC_END:
assert(term->vt.osc.idx < sizeof(term->vt.osc.data));
if (!osc_ensure_size(term, term->vt.osc.idx + 1))
break;
term->vt.osc.data[term->vt.osc.idx] = '\0';
osc_dispatch(term);
break;