dcs: DECRQSS: fix off-by-one when checking for space in the DCS buffer

This commit is contained in:
Daniel Eklöf 2024-04-10 05:44:33 +02:00
parent 09e45794bc
commit 9287946b36
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 3 additions and 1 deletions

View file

@ -64,6 +64,8 @@
* When closing the window, send `SIGHUP` to the client application,
before sending `SIGTERM`. The signal sequence is now `SIGHUP`, wait,
`SIGTERM`, wait `SIGKILL`.
* Crash when receiving a `DECRQSS` request with more than 2 bytes in
the `q` parameter.
[1666]: https://codeberg.org/dnkl/foot/issues/1666

2
dcs.c
View file

@ -239,7 +239,7 @@ decrqss_put(struct terminal *term, uint8_t c)
return;
struct vt *vt = &term->vt;
if (vt->dcs.idx > 2)
if (vt->dcs.idx >= 2)
return;
vt->dcs.data[vt->dcs.idx++] = c;
}