mirror of
				https://github.com/tmux/tmux.git
				synced 2025-11-04 00:56:10 +00:00 
			
		
		
		
	Reject $SHELL if it is not a full path.
This commit is contained in:
		
							
								
								
									
										4
									
								
								tmux.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								tmux.c
									
									
									
									
									
								
							@@ -98,7 +98,9 @@ getshell(void)
 | 
				
			|||||||
int
 | 
					int
 | 
				
			||||||
checkshell(const char *shell)
 | 
					checkshell(const char *shell)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	if (shell == NULL || *shell == '\0' || areshell(shell))
 | 
						if (shell == NULL || *shell == '\0' || *shell != '/')
 | 
				
			||||||
 | 
							return (0);
 | 
				
			||||||
 | 
						if (areshell(shell))
 | 
				
			||||||
		return (0);
 | 
							return (0);
 | 
				
			||||||
	if (access(shell, X_OK) != 0)
 | 
						if (access(shell, X_OK) != 0)
 | 
				
			||||||
		return (0);
 | 
							return (0);
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										2
									
								
								window.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								window.c
									
									
									
									
									
								
							@@ -697,7 +697,7 @@ window_pane_spawn(struct window_pane *wp, const char *cmd, const char *shell,
 | 
				
			|||||||
		if (*wp->cmd != '\0') {
 | 
							if (*wp->cmd != '\0') {
 | 
				
			||||||
			/* Set SHELL but only if it is currently not useful. */
 | 
								/* Set SHELL but only if it is currently not useful. */
 | 
				
			||||||
			shell = getenv("SHELL");
 | 
								shell = getenv("SHELL");
 | 
				
			||||||
			if (shell == NULL || *shell == '\0' || areshell(shell))
 | 
								if (checkshell(shell))
 | 
				
			||||||
				setenv("SHELL", wp->shell, 1);
 | 
									setenv("SHELL", wp->shell, 1);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			execl(_PATH_BSHELL, "sh", "-c", wp->cmd, (char *) NULL);
 | 
								execl(_PATH_BSHELL, "sh", "-c", wp->cmd, (char *) NULL);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user