Skip to content

Commit

Permalink
Fix endless loop in get_user_groups
Browse files Browse the repository at this point in the history
Co-authored-by: aw-cf <>
  • Loading branch information
GuillaumeGomez committed Nov 17, 2023
1 parent d03670b commit 18bad27
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/unix/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ pub(crate) unsafe fn get_user_groups(
&mut nb_groups as *mut _ as *mut _,
) == -1
{
// Ensure the length matches the number of returned groups.
// Needs to be updated for `Vec::reserve` to actually add additional capacity.
groups.set_len(nb_groups as _);
groups.reserve(256);
continue;
}
Expand Down

0 comments on commit 18bad27

Please sign in to comment.