aboutsummaryrefslogtreecommitdiff
path: root/dcs.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2024-04-20 06:19:58 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-04-20 06:27:25 +0000
commit4d4ef5eed536c373f93c766f4071e14665a9b00e (patch)
treef566a6bdbfb6cde19c85b61394323f0b89e8f264 /dcs.c
parentterm: default to DPI 96, if the monitor's DPI is 0 (diff)
dcs: XTGETTCAP: handle empty request
If the XTGETTCAP request is empty (no capabilities in it), reply with an empty error reply. Closes #1694
Diffstat (limited to 'dcs.c')
-rw-r--r--dcs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/dcs.c b/dcs.c
index 19cce3c2..4dccbdee 100644
--- a/dcs.c
+++ b/dcs.c
@@ -200,6 +200,12 @@ xtgettcap_unhook(struct terminal *term)
const char *const end = (const char *)&term->vt.dcs.data[left];
const char *p = (const char *)term->vt.dcs.data;
+ if (p == NULL) {
+ /* Request is empty; send an error reply, without any capabilities */
+ term_to_slave(term, "\033P0+r\033\\", 7);
+ return;
+ }
+
while (true) {
const char *sep = memchr(p, ';', left);
size_t cap_len;