]> granicus.if.org Git - sudo/commitdiff
Handle sudo_get_grlist() returning NULL which can happen if
authorTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 5 Feb 2015 18:17:24 +0000 (11:17 -0700)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Thu, 5 Feb 2015 18:17:24 +0000 (11:17 -0700)
getgrouplist() fails even after allocating the appropriate amount
of memory.  From Stephane Chazelas

plugins/sudoers/set_perms.c

index 76234af355fb544fb9ea25ada119d19592137e06..6b073c7e66f647bb5d0950a598facea1cd3532a0 100644 (file)
@@ -1589,9 +1589,11 @@ runas_setgroups(void)
 #ifdef HAVE_SETAUTHDB
     aix_restoreauthdb();
 #endif
-    if (sudo_setgroups(grlist->ngids, grlist->gids) < 0) {
-       sudo_grlist_delref(grlist);
-       grlist = NULL;
+    if (grlist != NULL) {
+       if (sudo_setgroups(grlist->ngids, grlist->gids) < 0) {
+           sudo_grlist_delref(grlist);
+           grlist = NULL;
+       }
     }
     debug_return_ptr(grlist);
 }