1 From: Todd C. Miller <Todd.Miller@courtesan.com>
2 Subject: Bug#640304: sudo received signal SIGBUS, Bus error
3 Date: Fri, 16 Sep 2011 08:48:33 -0400
5 A bus error is usually an alignment problem. I can see how this
6 could happen on 64-bit machines with strict alignment requirements
9 The following patch fixes the problem for me. It will be part of
10 a sudo 1.8.2p1 release.
14 diff -r d161b82321da plugins/sudoers/pwutil.c
15 --- a/plugins/sudoers/pwutil.c Thu Sep 15 19:56:34 2011 -0400
16 +++ b/plugins/sudoers/pwutil.c Fri Sep 16 08:19:18 2011 -0400
20 * Copy in group list and make pointers relative to space
21 - * at the end of the buffer. Note that the gids array must come
22 + * at the end of the buffer. Note that the groups array must come
23 * immediately after struct group to guarantee proper alignment.
25 grlist = (struct group_list *)cp;
26 zero_bytes(grlist, sizeof(struct group_list));
27 cp += sizeof(struct group_list);
28 + grlist->groups = (char **)cp;
29 + cp += sizeof(char *) * ngids;
30 grlist->gids = (gid_t *)cp;
31 cp += sizeof(gid_t) * ngids;
32 - grlist->groups = (char **)cp;
33 - cp += sizeof(char *) * ngids;
35 /* Set key and datum. */
36 memcpy(cp, user, nsize);