[sudo-users] patch: sudo command causes a bus error

Frans van Berckel fberckel at xs4all.nl
Fri Sep 16 09:27:49 EDT 2011


Hi Todd,

Thanks, your patch solved Debian issue #640304. CCing bug.


Frans van Berckel

On Fri, 2011-09-16 at 08:24 -0400, Todd C. Miller wrote:
> A bus error is usually an alignment problem.  I can see how this
> could happen on 64-bit machines with strict alignment requirements
> (such as sparc64).
> 
> Can you try the following patch?  You can apply with by running
> "patch -p1 filename" from inside the unpacked sudo source tarball.
> 
>  - todd
> 
> diff -r d161b82321da plugins/sudoers/pwutil.c
> --- a/plugins/sudoers/pwutil.c	Thu Sep 15 19:56:34 2011 -0400
> +++ b/plugins/sudoers/pwutil.c	Fri Sep 16 08:19:18 2011 -0400
> @@ -508,16 +533,16 @@
>  
>      /*
>       * Copy in group list and make pointers relative to space
> -     * at the end of the buffer.  Note that the gids array must come
> +     * at the end of the buffer.  Note that the groups array must come
>       * immediately after struct group to guarantee proper alignment.
>       */
>      grlist = (struct group_list *)cp;
>      zero_bytes(grlist, sizeof(struct group_list));
>      cp += sizeof(struct group_list);
> +    grlist->groups = (char **)cp;
> +    cp += sizeof(char *) * ngids;
>      grlist->gids = (gid_t *)cp;
>      cp += sizeof(gid_t) * ngids;
> -    grlist->groups = (char **)cp;
> -    cp += sizeof(char *) * ngids;
>  
>      /* Set key and datum. */
>      memcpy(cp, user, nsize);




More information about the sudo-users mailing list