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.
This commit is contained in:
Todd C. Miller
2010-09-14 11:30:28 -04:00
parent ce942f18c0
commit 53f9cfe062

View File

@@ -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 */