You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-admin/sudo/files/sudo-1.8.2-fix-pwutil-align...

46 lines
1.6 KiB

status: upstream
> Program received signal SIGBUS, Bus error.
> 0x0000020005ff64e0 in make_grlist_item (user=0x120037090 "root", gids=0x120037140, ngids=11) at ./pwutil.c:552
> 552 grlist->groups[ngroups++] = cp;
Found by armin76.
On alpha gid_t (grlist->gids) is 4-bytes long (and 4-bytes algned)
while char** (grlist->groups) is 8-bytes aligned.
Reorder to satisfy both alignmens.
# HG changeset patch
# User Todd C. Miller <Todd.Miller@courtesan.com>
# Date 1316193166 14400
# Branch 1.8
# Node ID e877c89ae32fc1fa7c3933f9599761d43f79dc96
# Parent f31543c80b9857cf4d14048be0c3ff34a47201c4
# Parent c89508c73c46bca11b6b9d3980cd4a511efcde6f
Fix a crash in make_grlist_item() on 64-bit machines with strict
alignment.
diff -r f31543c80b98 -r e877c89ae32f plugins/sudoers/pwutil.c
--- a/plugins/sudoers/pwutil.c Fri Sep 16 13:12:34 2011 -0400
+++ b/plugins/sudoers/pwutil.c Fri Sep 16 13:12:46 2011 -0400
@@ -508,16 +508,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);