From e6a59c4bee6ab5da56e3ff6b27a5e16d868d638f Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 25 Sep 2011 18:53:04 +0000 Subject: [PATCH] Reject $SHELL if it is not a full path. --- tmux.c | 4 +++- window.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tmux.c b/tmux.c index 196edf6c..5d4fda72 100644 --- a/tmux.c +++ b/tmux.c @@ -98,7 +98,9 @@ getshell(void) int checkshell(const char *shell) { - if (shell == NULL || *shell == '\0' || areshell(shell)) + if (shell == NULL || *shell == '\0' || *shell != '/') + return (0); + if (areshell(shell)) return (0); if (access(shell, X_OK) != 0) return (0); diff --git a/window.c b/window.c index 0736daeb..4f55c513 100644 --- a/window.c +++ b/window.c @@ -697,7 +697,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell, if (*wp->cmd != '\0') { /* Set SHELL but only if it is currently not useful. */ shell = getenv("SHELL"); - if (shell == NULL || *shell == '\0' || areshell(shell)) + if (checkshell(shell)) setenv("SHELL", wp->shell, 1); execl(_PATH_BSHELL, "sh", "-c", wp->cmd, (char *) NULL);