Fix NULL deref when an entry has no Runas_Entry

This commit is contained in:
Todd C. Miller
2012-08-22 15:50:58 -04:00
parent 81d42ae4e6
commit 793426106e

View File

@@ -253,7 +253,7 @@ sudo_file_lookup(struct sudo_nss *nss, int validated, int pwflag)
* set runas_pw = sudo_user.pw.
* XXX - hack, want more general solution
*/
if (matching_user->type == MYSELF) {
if (matching_user && matching_user->type == MYSELF) {
sudo_pw_delref(runas_pw);
sudo_pw_addref(sudo_user.pw);
runas_pw = sudo_user.pw;