Be more strict about what names and titles we allow and reject them

immediately when possible, but allow # again for those directly set by
commands (but not escape sequences). From Barrett Ruth in GitHub issue
5175.
This commit is contained in:
nicm
2026-06-15 21:41:39 +00:00
parent b86bd1fcd0
commit eb65331403
17 changed files with 144 additions and 81 deletions

View File

@@ -95,7 +95,7 @@ check_window_name(struct window *w)
name = format_window_name(w);
if (strcmp(name, w->name) != 0) {
log_debug("@%u new name %s (was %s)", w->id, name, w->name);
window_set_name(w, name);
window_set_name(w, name, WINDOW_NAME_FORBID_EXT);
server_redraw_window_borders(w);
server_status_window(w);
} else
@@ -166,7 +166,7 @@ parse_window_name(const char *in)
if (*name == '/')
name = basename(name);
name = clean_name(name, "#");
name = clean_name(name, WINDOW_NAME_FORBID);
free(copy);
if (name == NULL)
return (xstrdup(""));