From 32d3d3219b38b63591045e72e8e085d41dc6058b Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 14 Sep 2010 11:30:20 -0400 Subject: [PATCH] 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 --- sudo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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) { -- 2.40.0