osc: don't assert on \E]4 being followed by a ';'

This fixes a crash (in debug builds) that could be triggered by
e.g. cat:ing /dev/urandom.
This commit is contained in:
Daniel Eklöf 2020-06-09 17:33:26 +02:00
parent bf57d0c606
commit f72c982c89
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 5 additions and 0 deletions

View file

@ -57,6 +57,8 @@
* Sixel images being erased when printing text next to them.
* Crash when last rendered cursor cell had scrolled off screen and
`\E[J3` was executed.
* Assert (debug builds) when an `\e]4` OSC escape was not followed by
a `;`.
### Security

3
osc.c
View file

@ -431,6 +431,9 @@ osc_dispatch(struct terminal *term)
/* Set color<idx> */
string--;
if (*string != ';')
break;
assert(*string == ';');
for (const char *s_idx = strtok(string, ";"), *s_color = strtok(NULL, ";");