Reject $SHELL if it is not a full path.

pull/1/head
Nicholas Marriott 2011-09-25 18:53:04 +00:00
parent f14da260c8
commit e6a59c4bee
2 changed files with 4 additions and 2 deletions

4
tmux.c
View File

@ -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);

View File

@ -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);