From: Todd C. Miller Date: Tue, 14 Sep 2010 15:30:20 +0000 (-0400) Subject: In login mode, make a copy of the runas user's pw_shell for NewArgv[0] X-Git-Tag: SUDO_1_7_5~149 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=32d3d3219b38b63591045e72e8e085d41dc6058b;p=sudo In login mode, make a copy of the runas user's pw_shell for NewArgv[0] because 1) we modify it and 2) it will runas_pw gets freed before exec. --HG-- branch : 1.7 --- diff --git a/sudo.c b/sudo.c index a9e98dc05..b992eedac 100644 --- 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) {