From 115bb33257ece9eec1c890cc04683227678a895f Mon Sep 17 00:00:00 2001 From: nicm Date: Tue, 17 Mar 2020 11:10:12 +0000 Subject: 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. --- cmd-set-option.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'cmd-set-option.c') diff --git a/cmd-set-option.c b/cmd-set-option.c index 23b45230..2709dcdc 100644 --- a/cmd-set-option.c +++ b/cmd-set-option.c @@ -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); -- cgit v1.2.3