From: Todd C. Miller Date: Tue, 4 Jan 2011 17:44:23 +0000 (-0500) Subject: Fix NULL dereference with "sudo -g group" when the sudoers rule has X-Git-Tag: SUDO_1_7_5~82 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=26b315a2723525e7f0c158b4eab3fb0d52add5e6;p=sudo Fix NULL dereference with "sudo -g group" when the sudoers rule has no runas user or group listed. Fixes RedHat bug Bug 667103. --HG-- branch : 1.7 --- diff --git a/match.c b/match.c index 9d081f023..ad7725ebd 100644 --- a/match.c +++ b/match.c @@ -174,10 +174,11 @@ _runaslist_matches(user_list, group_list) int user_matched = UNSPEC; int group_matched = UNSPEC; - if (tq_empty(user_list) && tq_empty(group_list)) - return(userpw_matches(def_runas_default, runas_pw->pw_name, runas_pw)); - if (runas_pw != NULL) { + /* If no runas user or runas group listed in sudoers, use default. */ + if (tq_empty(user_list) && tq_empty(group_list)) + return(userpw_matches(def_runas_default, runas_pw->pw_name, runas_pw)); + tq_foreach_rev(user_list, m) { switch (m->type) { case ALL: