mirror of
https://github.com/tmux/tmux.git
synced 2025-09-01 20:57:00 +00:00
Ignore default-shell (and use /bin/sh) if it invalid not just if it is
tmux itself, also refuse to set the option to something invalid in the first place. GitHub issue 2120.
This commit is contained in:
@ -309,6 +309,13 @@ cmd_set_option_set(struct cmd *self, struct cmdq_item *item, struct options *oo,
|
||||
old = xstrdup(options_get_string(oo, oe->name));
|
||||
options_set_string(oo, oe->name, append, "%s", value);
|
||||
new = options_get_string(oo, oe->name);
|
||||
if (strcmp(oe->name, "default-shell") == 0 &&
|
||||
!checkshell(new)) {
|
||||
options_set_string(oo, oe->name, 0, "%s", old);
|
||||
free(old);
|
||||
cmdq_error(item, "not a suitable shell: %s", value);
|
||||
return (-1);
|
||||
}
|
||||
if (oe->pattern != NULL && fnmatch(oe->pattern, new, 0) != 0) {
|
||||
options_set_string(oo, oe->name, 0, "%s", old);
|
||||
free(old);
|
||||
|
Reference in New Issue
Block a user