]> granicus.if.org Git - sudo/commitdiff
In login mode, make a copy of the runas user's pw_shell for NewArgv[0]
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 14 Sep 2010 15:30:20 +0000 (11:30 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 14 Sep 2010 15:30:20 +0000 (11:30 -0400)
because 1) we modify it and 2) it will runas_pw gets freed before exec.

--HG--
branch : 1.7

sudo.c

diff --git a/sudo.c b/sudo.c
index a9e98dc05a5ccdbb265efb4a113b9d13668e46d4..b992eedacf1de2741b27c3f6a4b3a0f1f5f625f0 100644 (file)
--- a/sudo.c
+++ b/sudo.c
@@ -317,7 +317,7 @@ main(argc, argv, envp)
 
     /* Update initial shell now that runas is set. */
     if (ISSET(sudo_mode, MODE_LOGIN_SHELL))
-       NewArgv[0] = runas_pw->pw_shell;
+       NewArgv[0] = estrdup(runas_pw->pw_shell);
 
     /* This goes after sudoers is parsed since it may have timestamp options. */
     if (sudo_mode == MODE_KILL || sudo_mode == MODE_INVALIDATE) {