diff --git a/CHANGELOG.md b/CHANGELOG.md index 5e894eed..645e6e30 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -76,6 +76,8 @@ `BTN_LEFT+3` by default) ([#1364][1364]). * `file://` prefix from URI's are no longer stripped when opened/activated ([#1474][1474]). +* `XTGETTCAP` with capabilities that are not properly hex encoded will + be ignored, instead of echo:ed back to the TTY in an error response. [1391]: https://codeberg.org/dnkl/foot/issues/1391 [1448]: https://codeberg.org/dnkl/foot/pulls/1448 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);