[sudo-workers] sudo segfaults when using the -g option

Todd C. Miller Todd.Miller at courtesan.com
Tue Jan 4 12:37:52 EST 2011


I think this is better to simply move that bit until we have checked
that runas_pw is non-NULL.

 - todd

diff -r e26055d17b72 match.c
--- a/match.c	Tue Dec 21 12:21:49 2010 -0500
+++ b/match.c	Tue Jan 04 12:36:07 2011 -0500
@@ -174,10 +174,11 @@
     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));
 
-    if (runas_pw != NULL) {
 	tq_foreach_rev(user_list, m) {
 	    switch (m->type) {
 		case ALL:



More information about the sudo-workers mailing list