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
committed by Nicholas Marriott
parent 762e503978
commit 64e83caf04
17 changed files with 146 additions and 82 deletions

13
tmux.h
View File

@@ -96,6 +96,12 @@ struct winlink;
#define TMUX_LOCK_CMD "lock -np"
#endif
/* Forbidden characters in names. */
#define WINDOW_NAME_FORBID ":."
#define WINDOW_NAME_FORBID_EXT ":.#"
#define SESSION_NAME_FORBID ":."
#define SESSION_NAME_FORBID_EXT ":.#"
/* Minimum layout cell size, NOT including border lines. */
#define PANE_MINIMUM 1
@@ -2404,6 +2410,7 @@ void setblocking(int, int);
char *shell_argv0(const char *, int);
uint64_t get_timer(void);
char *clean_name(const char *, const char *);
int check_name(const char *, const char *);
const char *sig2name(int);
const char *find_cwd(void);
const char *find_home(void);
@@ -3375,8 +3382,8 @@ void screen_reset_hyperlinks(struct screen *);
void screen_set_default_cursor(struct screen *, struct options *);
void screen_set_cursor_style(u_int, enum screen_cursor_style *, int *);
void screen_set_cursor_colour(struct screen *, int);
int screen_set_title(struct screen *, const char *);
int screen_set_path(struct screen *, const char *);
int screen_set_title(struct screen *, const char *, int);
int screen_set_path(struct screen *, const char *, int);
void screen_push_title(struct screen *);
void screen_pop_title(struct screen *);
void screen_set_progress_bar(struct screen *, enum progress_bar_state, int);
@@ -3480,7 +3487,7 @@ void window_pane_stack_push(struct window_panes *,
struct window_pane *);
void window_pane_stack_remove(struct window_panes *,
struct window_pane *);
void window_set_name(struct window *, const char *);
void window_set_name(struct window *, const char *, const char *);
void window_add_ref(struct window *, const char *);
void window_remove_ref(struct window *, const char *);
void winlink_clear_flags(struct winlink *);