Handle sudo_get_grlist() returning NULL which can happen if
getgrouplist() fails even after allocating the appropriate amount of memory. From Stephane Chazelas
This commit is contained in:
@@ -1589,9 +1589,11 @@ runas_setgroups(void)
|
|||||||
#ifdef HAVE_SETAUTHDB
|
#ifdef HAVE_SETAUTHDB
|
||||||
aix_restoreauthdb();
|
aix_restoreauthdb();
|
||||||
#endif
|
#endif
|
||||||
if (sudo_setgroups(grlist->ngids, grlist->gids) < 0) {
|
if (grlist != NULL) {
|
||||||
sudo_grlist_delref(grlist);
|
if (sudo_setgroups(grlist->ngids, grlist->gids) < 0) {
|
||||||
grlist = NULL;
|
sudo_grlist_delref(grlist);
|
||||||
|
grlist = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
debug_return_ptr(grlist);
|
debug_return_ptr(grlist);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user