From 4ea6f73060c6b7c7fc24fbff78fc4c89a828e30f Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Mon, 4 Jan 2021 14:48:42 -0700 Subject: [PATCH] Fix a crash introduced in 1.9.4 when running "sudo -i" as an unknown user. --- plugins/sudoers/logging.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/sudoers/logging.c b/plugins/sudoers/logging.c index e0d46280c..776f881e5 100644 --- a/plugins/sudoers/logging.c +++ b/plugins/sudoers/logging.c @@ -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;