aboutsummaryrefslogtreecommitdiff
path: root/vt.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-07-19 06:59:35 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-07-19 06:59:35 +0000
commit153628a21749f954c4182c72335a9c3524e9a336 (patch)
tree9976a598e0600b9ba74582be2865c97cbffbc235 /vt.c
parentosc: terminate reply with ST rather than BEL (diff)
osc: allocate data buffer dynamically
Diffstat (limited to 'vt.c')
-rw-r--r--vt.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/vt.c b/vt.c
index 3ce99250..8899fc74 100644
--- a/vt.c
+++ b/vt.c
@@ -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;