]> granicus.if.org Git - sudo/commitdiff
Fix a crash in make_grlist_item() on 64-bit machines with strict
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 16 Sep 2011 13:05:37 +0000 (09:05 -0400)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 16 Sep 2011 13:05:37 +0000 (09:05 -0400)
alignment.

plugins/sudoers/pwutil.c

index b511472c3fdc2e79be62d0c38a85f591b90ebc63..fc45787e79530f8b63f6bc50ccc3c3603296c1f3 100644 (file)
@@ -508,16 +508,16 @@ make_grlist_item(const char *user, GETGROUPS_T *gids, int ngids)
 
     /*
      * 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->gids = (gid_t *)cp;
-    cp += sizeof(gid_t) * ngids;
     grlist->groups = (char **)cp;
     cp += sizeof(char *) * ngids;
+    grlist->gids = (gid_t *)cp;
+    cp += sizeof(gid_t) * ngids;
 
     /* Set key and datum. */
     memcpy(cp, user, nsize);