Fix crash when "sudo -g group -i" is run. Fixes bug 521

This commit is contained in:
Todd C. Miller
2011-11-03 09:31:20 -04:00
parent 922add7801
commit ab803d88b5

View File

@@ -342,7 +342,7 @@ sudoers_policy_main(int argc, char * const argv[], int pwflag, char *env_add[],
NewArgv = emalloc2(NewArgc + 2, sizeof(char *));
memcpy(++NewArgv, argv, argc * sizeof(char *));
NewArgv[NewArgc] = NULL;
if (ISSET(sudo_mode, MODE_LOGIN_SHELL))
if (ISSET(sudo_mode, MODE_LOGIN_SHELL) && runas_pw != NULL)
NewArgv[0] = estrdup(runas_pw->pw_shell);
}