[sudo-workers] sudo -l segfaults

Todd C. Miller Todd.Miller at courtesan.com
Thu Oct 30 10:37:22 EDT 2008


In message <20081030152452.5601d0bc at dhcp-lab-189.englab.brq.redhat.com>
	so spake Daniel =?UTF-8?B?S29wZcSNZWs=?= (dkopecek):

> diff -up sudo-1.6.9p13/parse.yacc.orig sudo-1.6.9p13/parse.yacc
> --- sudo-1.6.9p13/parse.yacc.orig	2008-10-30 14:07:52.000000000 +0100
> +++ sudo-1.6.9p13/parse.yacc	2008-10-30 14:06:58.000000000 +0100
> @@ -569,6 +569,7 @@ selinux		:	/* empty */ {
>  #ifdef HAVE_SELINUX
>  			    if (printmatches == TRUE && host_matches == TRUE &&
>  				user_matches == TRUE && runas_matches == TRUE) 
> {
> +			      if (match[top-1].role != NULL) {
>  				/* Inherit role. */
>  				cm_list[cm_list_len].role =
>  				    estrdup(cm_list[cm_list_len-1].role);
> @@ -576,6 +577,12 @@ selinux		:	/* empty */ {
>  				    cm_list[cm_list_len-1].role_len;
>  				cm_list[cm_list_len].role_size =
>  				    cm_list[cm_list_len-1].role_len + 1;
> +			      } else {
> +				cm_list[cm_list_len].role = NULL;
> +				cm_list[cm_list_len].role_len = 0;
> +				cm_list[cm_list_len].role_size = 0;
> +			      }
> +			      if (match[top-1].type != NULL) {
>  				/* Inherit type. */
>  				cm_list[cm_list_len].type =
>  				    estrdup(cm_list[cm_list_len-1].type);

The part where you zero out role et al in the match[top-1].role ==
NULL case should not be required as that will already be zero.

 - todd



More information about the sudo-workers mailing list