aboutsummaryrefslogtreecommitdiff
path: root/dcs.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-09-25 14:37:32 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-09-25 14:37:32 +0000
commit8a5f2915e9d327d1517d1da49ce7e2303fe61d36 (patch)
tree5ef79178ae15602102d43462daa6b7c6782f0593 /dcs.c
parenturl-mode: don't strip the file:// prefix from localhost URIs (diff)
dcs: xtgettcap: ignore queries with invalid hex encodings
When we receive an XTGETTCAP query, where the capability is not correctly hex encoded, ignore it. Before this patch, we echo:ed it back to the TTY inside an error resonse.
Diffstat (limited to 'dcs.c')
-rw-r--r--dcs.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/dcs.c b/dcs.c
index 7ce1a868..601f1172 100644
--- a/dcs.c
+++ b/dcs.c
@@ -111,14 +111,11 @@ static void
xtgettcap_reply(struct terminal *term, const char *hex_cap_name, size_t len)
{
char *name = hex_decode(hex_cap_name, len);
- if (name == NULL)
- goto err;
+ if (name == NULL) {
+ LOG_WARN("XTGETTCAP: invalid hex encoding, ignoring capability");
+ return;
+ }
-#if 0
- const struct foot_terminfo_entry *entry =
- bsearch(name, terminfo_capabilities, ALEN(terminfo_capabilities),
- sizeof(*entry), &terminfo_entry_compar);
-#endif
const char *value;
bool valid_capability = lookup_capability(name, &value);
xassert(!valid_capability || value != NULL);