From 53f9cfe062ffff0b5e6f56e94afabfc44326c9d3 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Tue, 14 Sep 2010 11:30:28 -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. --- plugins/sudoers/sudoers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sudoers/sudoers.c b/plugins/sudoers/sudoers.c index 18606e7de..e4ca9183a 100644 --- a/plugins/sudoers/sudoers.c +++ b/plugins/sudoers/sudoers.c @@ -347,7 +347,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[], memcpy(NewArgv, argv, argc * sizeof(char *)); NewArgv[NewArgc] = NULL; if (ISSET(sudo_mode, MODE_LOGIN_SHELL)) - NewArgv[0] = runas_pw->pw_shell; + NewArgv[0] = estrdup(runas_pw->pw_shell); } /* Find command in path */ -- 2.40.0