]> 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:28 +0000 (11:30 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 14 Sep 2010 15:30:28 +0000 (11:30 -0400)
because 1) we modify it and 2) it will runas_pw gets freed before exec.

plugins/sudoers/sudoers.c

index 18606e7de9eeae7fb429418a16f957563348ef90..e4ca9183a3f9a0a53a10f1edcc762bea9f2d9f09 100644 (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 */