summaryrefslogtreecommitdiffstats
path: root/cmd-set-option.c
diff options
context:
space:
mode:
authornicm <nicm>2020-03-17 11:10:12 +0000
committernicm <nicm>2020-03-17 11:10:12 +0000
commit115bb33257ece9eec1c890cc04683227678a895f (patch)
tree0352f5aa8363bd3f98f9c6f2f94d0354c85a88d0 /cmd-set-option.c
parentfb396286ff8330f35eae54f47b7f233839a23e6f (diff)
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.
Diffstat (limited to 'cmd-set-option.c')
-rw-r--r--cmd-set-option.c7
1 files changed, 7 insertions, 0 deletions
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);