Fix a crash introduced in 1.9.4 when running "sudo -i" as an unknown user.

This commit is contained in:
Todd C. Miller
2021-01-04 14:48:42 -07:00
parent 7f34b8bbbd
commit 4ea6f73060

View File

@@ -669,7 +669,7 @@ sudoers_to_eventlog(struct eventlog *evlog, char * const argv[],
}
if (def_runcwd && strcmp(def_runcwd, "*") != 0) {
evlog->runcwd = def_runcwd;
} else if (ISSET(sudo_mode, MODE_LOGIN_SHELL)) {
} else if (ISSET(sudo_mode, MODE_LOGIN_SHELL) && runas_pw != NULL) {
evlog->runcwd = runas_pw->pw_dir;
} else {
evlog->runcwd = user_cwd;