diff options
author | 2011-09-25 18:53:04 +0000 | |
---|---|---|
committer | 2011-09-25 18:53:04 +0000 | |
commit | a89a0cee0e4b7c85d8511ad444f84653c2a41d82 (patch) | |
tree | 609df78d18d44a493ca7fd7437561eee5d6a5440 | |
parent | tweak previous; ok schwarze (diff) | |
download | wireguard-openbsd-a89a0cee0e4b7c85d8511ad444f84653c2a41d82.tar.xz wireguard-openbsd-a89a0cee0e4b7c85d8511ad444f84653c2a41d82.zip |
Reject $SHELL if it is not a full path.
-rw-r--r-- | usr.bin/tmux/tmux.c | 6 | ||||
-rw-r--r-- | usr.bin/tmux/window.c | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/usr.bin/tmux/tmux.c b/usr.bin/tmux/tmux.c index b12a8fbbb52..d5320ea1d18 100644 --- a/usr.bin/tmux/tmux.c +++ b/usr.bin/tmux/tmux.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.c,v 1.104 2011/03/04 23:26:44 nicm Exp $ */ +/* $OpenBSD: tmux.c,v 1.105 2011/09/25 18:53:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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/usr.bin/tmux/window.c b/usr.bin/tmux/window.c index cc878b60cd0..f4d0da653c7 100644 --- a/usr.bin/tmux/window.c +++ b/usr.bin/tmux/window.c @@ -1,4 +1,4 @@ -/* $OpenBSD: window.c,v 1.67 2011/08/24 10:29:57 nicm Exp $ */ +/* $OpenBSD: window.c,v 1.68 2011/09/25 18:53:04 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -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); |